proj_name
stringclasses
26 values
relative_path
stringlengths
42
165
class_name
stringlengths
3
46
func_name
stringlengths
2
44
masked_class
stringlengths
80
7.9k
func_body
stringlengths
76
5.98k
initial_context
stringclasses
74 values
parent_class_output
stringlengths
20
1.75k
parent_class_output_re_type
sequencelengths
0
9
parent_class_output_re_method
sequencelengths
0
35
func_body_re_type
sequencelengths
0
14
func_body_re_method
sequencelengths
0
39
parent_class_output_re
dict
relevant_context
stringlengths
0
82.6k
relevant_context_no_cmt
stringlengths
0
25.5k
retrieved_names
stringlengths
39
1.24k
retrieved_types
stringlengths
2
106k
retrieved_methods
stringlengths
2
11.5k
similar_methods
stringlengths
2
3.74k
qiujiayu_AutoLoadCache
AutoLoadCache/autoload-cache-serializer/autoload-cache-serializer-protobuf/src/main/java/com/jarvis/cache/serializer/protobuf/HeapByteBufUtil.java
HeapByteBufUtil
setIntLE
class HeapByteBufUtil { static byte getByte(byte[] memory, int index) { return memory[index]; } static short getShort(byte[] memory, int index) { return (short) (memory[index] << 8 | memory[index + 1] & 0xFF); } static short getShortLE(byte[] memory, int index) { return (short) (memory[index] & 0xff | memory[index + 1] << 8); } static int getUnsignedMedium(byte[] memory, int index) { return (memory[index] & 0xff) << 16 | (memory[index + 1] & 0xff) << 8 | memory[index + 2] & 0xff; } static int getUnsignedMediumLE(byte[] memory, int index) { return memory[index] & 0xff | (memory[index + 1] & 0xff) << 8 | (memory[index + 2] & 0xff) << 16; } static int getInt(byte[] memory, int index) { return (memory[index] & 0xff) << 24 | (memory[index + 1] & 0xff) << 16 | (memory[index + 2] & 0xff) << 8 | memory[index + 3] & 0xff; } static int getIntLE(byte[] memory, int index) { return memory[index] & 0xff | (memory[index + 1] & 0xff) << 8 | (memory[index + 2] & 0xff) << 16 | (memory[index + 3] & 0xff) << 24; } static long getLong(byte[] memory, int index) { return ((long) memory[index] & 0xff) << 56 | ((long) memory[index + 1] & 0xff) << 48 | ((long) memory[index + 2] & 0xff) << 40 | ((long) memory[index + 3] & 0xff) << 32 | ((long) memory[index + 4] & 0xff) << 24 | ((long) memory[index + 5] & 0xff) << 16 | ((long) memory[index + 6] & 0xff) << 8 | (long) memory[index + 7] & 0xff; } static long getLongLE(byte[] memory, int index) { return (long) memory[index] & 0xff | ((long) memory[index + 1] & 0xff) << 8 | ((long) memory[index + 2] & 0xff) << 16 | ((long) memory[index + 3] & 0xff) << 24 | ((long) memory[index + 4] & 0xff) << 32 | ((long) memory[index + 5] & 0xff) << 40 | ((long) memory[index + 6] & 0xff) << 48 | ((long) memory[index + 7] & 0xff) << 56; } static void setByte(byte[] memory, int index, int value) { memory[index] = (byte) value; } static void setShort(byte[] memory, int index, int value) { memory[index] = (byte) (value >>> 8); memory[index + 1] = (byte) value; } static void setShortLE(byte[] memory, int index, int value) { memory[index] = (byte) value; memory[index + 1] = (byte) (value >>> 8); } static void setMedium(byte[] memory, int index, int value) { memory[index] = (byte) (value >>> 16); memory[index + 1] = (byte) (value >>> 8); memory[index + 2] = (byte) value; } static void setMediumLE(byte[] memory, int index, int value) { memory[index] = (byte) value; memory[index + 1] = (byte) (value >>> 8); memory[index + 2] = (byte) (value >>> 16); } static void setInt(byte[] memory, int index, int value) { memory[index] = (byte) (value >>> 24); memory[index + 1] = (byte) (value >>> 16); memory[index + 2] = (byte) (value >>> 8); memory[index + 3] = (byte) value; } static void setIntLE(byte[] memory, int index, int value) {<FILL_FUNCTION_BODY>} static void setLong(byte[] memory, int index, long value) { memory[index] = (byte) (value >>> 56); memory[index + 1] = (byte) (value >>> 48); memory[index + 2] = (byte) (value >>> 40); memory[index + 3] = (byte) (value >>> 32); memory[index + 4] = (byte) (value >>> 24); memory[index + 5] = (byte) (value >>> 16); memory[index + 6] = (byte) (value >>> 8); memory[index + 7] = (byte) value; } static void setLongLE(byte[] memory, int index, long value) { memory[index] = (byte) value; memory[index + 1] = (byte) (value >>> 8); memory[index + 2] = (byte) (value >>> 16); memory[index + 3] = (byte) (value >>> 24); memory[index + 4] = (byte) (value >>> 32); memory[index + 5] = (byte) (value >>> 40); memory[index + 6] = (byte) (value >>> 48); memory[index + 7] = (byte) (value >>> 56); } private HeapByteBufUtil() { } }
memory[index] = (byte) value; memory[index + 1] = (byte) (value >>> 8); memory[index + 2] = (byte) (value >>> 16); memory[index + 3] = (byte) (value >>> 24);
memory[index] = (byte) value; memory[index + 1] = (byte) (value >>> 8); memory[index + 2] = (byte) (value >>> 16); memory[index + 3] = (byte) (value >>> 24);
[]
[]
[]
[]
{ "methods": [], "similar_methods": [ "setIntLE" ], "types": [] }
{"similar_methods": [{"setIntLE": ""}]}
[]
[]
[]
jitsi_jitsi
jitsi/modules/plugin/otr/src/main/java/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java
OtrMetaContactMenu
createOtrContactMenus
class OtrMetaContactMenu extends AbstractPluginComponent implements ActionListener, PopupMenuListener { /** * The last known <tt>MetaContact</tt> to be currently selected and to be * depicted by this instance and the <tt>OtrContactMenu</tt>s it contains. */ private MetaContact currentContact; /** * The indicator which determines whether the <tt>JMenu</tt> of this * <tt>OtrMetaContactMenu</tt> is displayed in the Mac OS X screen menu bar * and thus should work around the known problem of PopupMenuListener not * being invoked. */ private final boolean inMacOSXScreenMenuBar; /** * The <tt>JMenu</tt> which is the component of this plug-in. */ private JMenu menu; /** * The "What's this?" <tt>JMenuItem</tt> which launches help on the subject * of off-the-record messaging. */ private JMenuItem whatsThis; public OtrMetaContactMenu(Container container, PluginComponentFactory parentFactory) { super(container, parentFactory); inMacOSXScreenMenuBar = Container.CONTAINER_CHAT_MENU_BAR.equals(container) && OSUtils.IS_MAC; } /* * Implements ActionListener#actionPerformed(ActionEvent). Handles the * invocation of the whatsThis menu item i.e. launches help on the subject * of off-the-record messaging. */ public void actionPerformed(ActionEvent e) { OtrActivator.scOtrEngine.launchHelp(); } /** * Creates an {@link OtrContactMenu} for each {@link Contact} contained in * the <tt>metaContact</tt>. * * @param metaContact The {@link MetaContact} this * {@link OtrMetaContactMenu} refers to. */ private void createOtrContactMenus(MetaContact metaContact) {<FILL_FUNCTION_BODY>} /* * Implements PluginComponent#getComponent(). Returns the JMenu which is the * component of this plug-in creating it first if it doesn't exist. */ public Component getComponent() { return getMenu(); } /** * Gets the <tt>JMenu</tt> which is the component of this plug-in. If it * still doesn't exist, it's created. * * @return the <tt>JMenu</tt> which is the component of this plug-in */ private JMenu getMenu() { if (menu == null) { menu = new SIPCommMenu(); menu.setText(getName()); if (Container.CONTAINER_CONTACT_RIGHT_BUTTON_MENU .equals(getContainer())) { Icon icon = OtrActivator.resourceService .getImage("plugin.otr.MENU_ITEM_ICON_16x16"); if (icon != null) menu.setIcon(icon); } if (!inMacOSXScreenMenuBar) menu.getPopupMenu().addPopupMenuListener(this); } return menu; } /* * Implements PluginComponent#getName(). */ public String getName() { return OtrActivator.resourceService .getI18NString("plugin.otr.menu.TITLE"); } /* * Implements PopupMenuListener#popupMenuCanceled(PopupMenuEvent). */ public void popupMenuCanceled(PopupMenuEvent e) { createOtrContactMenus(null); } /* * Implements PopupMenuListener#popupMenuWillBecomeInvisible( * PopupMenuEvent). */ public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { popupMenuCanceled(e); } /* * Implements PopupMenuListener#popupMenuWillBecomeVisible(PopupMenuEvent). */ public void popupMenuWillBecomeVisible(PopupMenuEvent e) { createOtrContactMenus(currentContact); JMenu menu = getMenu(); menu.addSeparator(); whatsThis = new JMenuItem(); whatsThis.setIcon( OtrActivator.resourceService.getImage( "plugin.otr.HELP_ICON_15x15")); whatsThis.setText( OtrActivator.resourceService.getI18NString( "plugin.otr.menu.WHATS_THIS")); whatsThis.addActionListener(this); menu.add(whatsThis); } /* * Implements PluginComponent#setCurrentContact(MetaContact). */ @Override public void setCurrentContact(MetaContact metaContact) { if (this.currentContact != metaContact) { this.currentContact = metaContact; if (inMacOSXScreenMenuBar) popupMenuWillBecomeVisible(null); else if ((menu != null) && menu.isPopupMenuVisible()) createOtrContactMenus(currentContact); } } }
JMenu menu = getMenu(); // Remove any existing OtrContactMenu items. menu.removeAll(); // Create the new OtrContactMenu items. if (metaContact != null) { Iterator<Contact> contacts = metaContact.getContacts(); if (metaContact.getContactCount() == 1) { Contact contact = contacts.next(); Collection<ContactResource> resources = contact.getResources(); if (contact.supportResources() && resources != null && resources.size() > 0) { for (ContactResource resource : resources) { new OtrContactMenu( OtrContactManager.getOtrContact(contact, resource), inMacOSXScreenMenuBar, menu, true); } } else new OtrContactMenu( OtrContactManager.getOtrContact(contact, null), inMacOSXScreenMenuBar, menu, false); } else while (contacts.hasNext()) { Contact contact = contacts.next(); Collection<ContactResource> resources = contact.getResources(); if (contact.supportResources() && resources != null && resources.size() > 0) { for (ContactResource resource : resources) { new OtrContactMenu( OtrContactManager.getOtrContact( contact, resource), inMacOSXScreenMenuBar, menu, true); } } else new OtrContactMenu( OtrContactManager.getOtrContact(contact, null), inMacOSXScreenMenuBar, menu, true); } }
/** * Provides an abstract base implementation of <code>PluginComponent</code> in order to take care of the implementation boilerplate and let implementers focus on the specifics of their plug-in. * @author Lyubomir Marinov */ public abstract class AbstractPluginComponent implements PluginComponent { /** * The parent factory. */ private final PluginComponentFactory parentFactory; /** * The container in which the component of this plug-in is to be added. */ private final Container container; /** * Initializes a new <code>AbstractPluginComponent</code> which is to be added to a specific <code>Container</code>. * @param container the container in which the component of the new plug-inis to be added * @param parentFactory the parent <tt>PluginComponentFactory</tt> that iscreating this plugin component. */ protected AbstractPluginComponent( Container container, PluginComponentFactory parentFactory); public String getConstraints(); public Container getContainer(); /** * Implements {@link PluginComponent#getPositionIndex()}. Returns <tt>-1</tt> which indicates that the position of this <tt>AbstractPluginComponent</tt> within its <tt>Container</tt> is of no importance. * @return <tt>-1</tt> which indicates that the position of this<tt>AbstractPluginComponent</tt> within its <tt>Container</tt> is of no importance * @see PluginComponent#getPositionIndex() */ public int getPositionIndex(); public boolean isNativeComponent(); public void setCurrentContact( Contact contact); public void setCurrentContact( Contact contact, String resourceName); public void setCurrentContact( MetaContact metaContact); public void setCurrentContactGroup( MetaContactGroup metaGroup); public void setCurrentAccountID( AccountID accountID); /** * Returns the factory that has created the component. * @return the parent factory. */ public PluginComponentFactory getParentFactory(); }
if (metaContact != null) { for (Contact contact : metaContact.getContacts()) { OtrContactMenu otrContactMenu = new OtrContactMenu(getContainer(), getParentFactory()); otrContactMenu.setCurrentContact(contact); menu.add(otrContactMenu); } } else { menu.removeAll(); }
[ "Contact", "JMenu", "OtrContactMenu", "MetaContact" ]
[ "setCurrentContact", "removeAll", "add", "getContacts" ]
[ "MetaContact", "ContactResource", "Iterator<Contact>", "JMenu", "Collection<ContactResource>", "Contact" ]
[ "supportResources", "getResources", "getContactCount", "hasNext", "size", "removeAll", "getOtrContact", "getContacts", "next" ]
{ "methods": [ "setCurrentContact", "removeAll", "add", "getContacts" ], "similar_methods": [ "createOtrContactMenus" ], "types": [ "Contact", "JMenu", "OtrContactMenu", "MetaContact" ] }
/** * This class represents the notion of a Contact or Buddy, that is widely used in instant messaging today. From a protocol point of view, a contact is generally considered to be another user of the service that proposes the protocol. Instances of Contact could be used for delivery of presence notifications or when addressing instant messages. * @author Emil Ivov */ public interface Contact { /** * Returns a String that can be used for identifying the contact. The exact contents of the string depends on the protocol. In the case of SIP, for example, that would be the SIP uri (e.g. sip:alice@biloxi.com) in the case of icq - a UIN (12345653) and for AIM a screenname (mysname). Jabber (and hence Google) would be having e-mail like addresses. * @return a String id representing and uniquely identifying the contact. */ public String getAddress(); /** * Returns a String that could be used by any user interacting modules for referring to this contact. An alias is not necessarily unique but is often more human readable than an address (or id). * @return a String that can be used for referring to this contact wheninteracting with the user. */ public String getDisplayName(); /** * Returns a byte array containing an image (most often a photo or an avatar) that the contact uses as a representation. * @return byte[] an image representing the contact. */ public byte[] getImage(); /** * Returns the status of the contact as per the last status update we've received for it. Note that this method is not to perform any network operations and will simply return the status received in the last status update message. If you want a reliable way of retrieving someone's status, you should use the <tt>queryContactStatus()</tt> method in <tt>OperationSetPresence</tt>. * @return the PresenceStatus that we've received in the last status updatepertaining to this contact. */ public PresenceStatus getPresenceStatus(); /** * Returns a reference to the contact group that this contact is currently a child of or null if the underlying protocol does not support persistent presence. * @return a reference to the contact group that this contact is currentlya child of or null if the underlying protocol does not support persistent presence. */ public ContactGroup getParentContactGroup(); /** * Returns a reference to the protocol provider that created the contact. * @return a reference to an instance of the ProtocolProviderService */ public ProtocolProviderService getProtocolProvider(); /** * Determines whether or not this contact is being stored by the server. Non persistent contacts are common in the case of simple, non-persistent presence operation sets. They could however also be seen in persistent presence operation sets when for example we have received an event from someone not on our contact list. Non persistent contacts are volatile even when coming from a persistent presence op. set. They would only exist until the application is closed and will not be there next time it is loaded. * @return true if the contact is persistent and false otherwise. */ public boolean isPersistent(); /** * Determines whether or not this contact has been resolved against the server. Unresolved contacts are used when initially loading a contact list that has been stored in a local file until the presence operation set has managed to retrieve all the contact list from the server and has properly mapped contacts to their on-line buddies. * @return true if the contact has been resolved (mapped against a buddy)and false otherwise. */ public boolean isResolved(); /** * Returns a String that can be used to create a unresolved instance of this contact. Unresolved contacts are created through the createUnresolvedContact() method in the persistent presence operation set. The method may also return null if no such data is required and the contact address is sufficient for restoring the contact. <p> * @return A <tt>String</tt> that could be used to create a unresolvedinstance of this contact during a next run of the application, before establishing network connectivity or null if no such data is required. */ public String getPersistentData(); /** * Return the current status message of this contact. * @return the current status message */ public String getStatusMessage(); /** * Indicates if this contact supports resources. * @return <tt>true</tt> if this contact supports resources, <tt>false</tt>otherwise */ public boolean supportResources(); /** * Returns a collection of resources supported by this contact or null if it doesn't support resources. * @return a collection of resources supported by this contact or nullif it doesn't support resources */ public Collection<ContactResource> getResources(); /** * Adds the given <tt>ContactResourceListener</tt> to listen for events related to contact resources changes. * @param l the <tt>ContactResourceListener</tt> to add */ public void addResourceListener( ContactResourceListener l); /** * Removes the given <tt>ContactResourceListener</tt> listening for events related to contact resources changes. * @param l the <tt>ContactResourceListener</tt> to rmove */ public void removeResourceListener( ContactResourceListener l); /** * Returns the persistent contact address. * @return the address of the contact. */ public String getPersistableAddress(); /** * Whether contact is mobile one. Logged in only from mobile device. * @return whether contact is mobile one. */ public boolean isMobile(); } /** * The <tt>HelpMenu</tt> is a menu in the main application menu bar. * @author Yana Stamcheva * @author Thomas Hofer * @author Lyubomir Marinov */ public class HelpMenu extends SIPCommMenu implements ActionListener { /** * The <tt>PluginContainer</tt> which implements the logic related to dealing with <tt>PluginComponent</tt>s on behalf of this <tt>HelpMenu</tt>. */ private final PluginContainer pluginContainer; /** * Creates an instance of <tt>HelpMenu</tt>. * @param mainFrame the parent window */ public HelpMenu( MainFrame mainFrame); /** * Handles the <tt>ActionEvent</tt> when one of the menu items is selected. * @param ev */ @Override public void actionPerformed( ActionEvent ev); } /** * A special {@link JMenu} that holds the menu items for controlling theOff-the-Record functionality for a specific contact. * @author George Politis * @author Lyubomir Marinov * @author Marin Dzhigarov */ class OtrContactMenu implements ActionListener, ScOtrEngineListener, ScOtrKeyManagerListener { private final org.slf4j.Logger logger=org.slf4j.LoggerFactory.getLogger(OtrContactMenu.class); private static final String ACTION_COMMAND_AUTHENTICATE_BUDDY="AUTHENTICATE_BUDDY"; private static final String ACTION_COMMAND_CB_AUTO="CB_AUTO"; private static final String ACTION_COMMAND_CB_AUTO_ALL="CB_AUTO_ALL"; private static final String ACTION_COMMAND_CB_ENABLE="CB_ENABLE"; private static final String ACTION_COMMAND_CB_REQUIRE="CB_REQUIRE"; private static final String ACTION_COMMAND_CB_RESET="CB_RESET"; private static final String ACTION_COMMAND_END_OTR="END_OTR"; private static final String ACTION_COMMAND_REFRESH_OTR="REFRESH_OTR"; private static final String ACTION_COMMAND_START_OTR="START_OTR"; private final OtrContact contact; /** * The indicator which determines whether this <tt>JMenu</tt> is displayed in the Mac OS X screen menu bar and thus should work around the known problem of PopupMenuListener not being invoked. */ private final boolean inMacOSXScreenMenuBar; /** * We keep this variable so we can determine if the policy has changed or not in {@link OtrContactMenu#setOtrPolicy(OtrPolicy)}. */ private OtrPolicy otrPolicy; private ScSessionStatus sessionStatus; private final JMenu parentMenu; private final SIPCommMenu separateMenu; /** * The OtrContactMenu constructor. * @param otrContact the OtrContact this menu refers to. * @param inMacOSXScreenMenuBar <tt>true</tt> if the new menu is to bedisplayed in the Mac OS X screen menu bar; <tt>false</tt>, otherwise * @param menu the parent menu */ public OtrContactMenu( OtrContact otrContact, boolean inMacOSXScreenMenuBar, JMenu menu, boolean isSeparateMenu); public void actionPerformed( ActionEvent e); public void contactPolicyChanged( Contact contact); public void contactVerificationStatusChanged( OtrContact otrContact); /** * Disposes of this instance by making it available for garage collection e.g. removes the listeners it has installed on global instances such as <tt>OtrActivator#scOtrEngine</tt> and <tt>OtrActivator#scOtrKeyManager</tt>. */ void dispose(); public void globalPolicyChanged(); /** * Rebuilds own menuitems according to {@link OtrContactMenu#sessionStatus}and the {@link OtrPolicy} for {@link OtrContactMenu#contact}. */ private void buildMenu(); public void sessionStatusChanged(OtrContact otrContact); /** * Sets the {@link OtrContactMenu#sessionStatus} value, updates the menuicon and, if necessary, rebuilds the menuitems to match the passed in sessionStatus. * @param sessionStatus the {@link ScSessionStatus}. */ private void setSessionStatus(ScSessionStatus sessionStatus); /** * Sets the {@link OtrContactMenu#otrPolicy} and, if necessary, rebuilds themenuitems to match the passed in otrPolicy. * @param otrPolicy */ private void setOtrPolicy(OtrPolicy otrPolicy); /** * Updates the menu icon based on {@link OtrContactMenu#sessionStatus}value. */ private void updateIcon(); @Override public void multipleInstancesDetected(OtrContact contact); @Override public void outgoingSessionChanged(OtrContact otrContact); } /** * A MetaContact is an abstraction used for merging multiple Contacts (most often) belonging to different <tt>ProtocolProvider</tt>s. <p> Instances of a MetaContact are read-only objects that cannot be modified directly but only through the corresponding MetaContactListService. </p> * @author Emil Ivov * @author Lubomir Marinov */ public interface MetaContact extends Comparable<MetaContact> { /** * Returns the default protocol specific <tt>Contact</tt> to use when communicating with this <tt>MetaContact</tt>. * @return the default <tt>Contact</tt> to use when communicating withthis <tt>MetaContact</tt> */ public Contact getDefaultContact(); /** * Returns the default protocol specific <tt>Contact</tt> to use with this <tt>MetaContact</tt> for a precise operation (IM, call, ...). * @param operationSet the operation for which the default contact is needed * @return the default contact for the specified operation. */ public Contact getDefaultContact( Class<? extends OperationSet> operationSet); /** * Returns a <tt>java.util.Iterator</tt> with all protocol specific <tt>Contacts</tt> encapsulated by this <tt>MetaContact</tt>. <p> Note to implementors: In order to prevent problems with concurrency, the <tt>Iterator</tt> returned by this method should not be over the actual list of contacts but rather over a copy of that list. <p> * @return a <tt>java.util.Iterator</tt> containing all protocol specific<tt>Contact</tt>s that were registered as subcontacts for this <tt>MetaContact</tt> */ public Iterator<Contact> getContacts(); /** * Returns a contact encapsulated by this meta contact, having the specified contactAddress and coming from the indicated ownerProvider. * @param contactAddress the address of the contact who we're looking for. * @param ownerProvider a reference to the ProtocolProviderService thatthe contact we're looking for belongs to. * @return a reference to a <tt>Contact</tt>, encapsulated by thisMetaContact, carrying the specified address and originating from the specified ownerProvider or null if no such contact exists.. */ public Contact getContact( String contactAddress, ProtocolProviderService ownerProvider); /** * Returns <tt>true</tt> if the given <tt>protocolContact</tt> is contained in this <tt>MetaContact</tt>, otherwise - returns <tt>false</tt>. * @param protocolContact the <tt>Contact</tt> we're looking for * @return <tt>true</tt> if the given <tt>protocolContact</tt> is containedin this <tt>MetaContact</tt>, otherwise - returns <tt>false</tt> */ public boolean containsContact( Contact protocolContact); /** * Returns the number of protocol speciic <tt>Contact</tt>s that this <tt>MetaContact</tt> contains. * @return an int indicating the number of protocol specific contacts mergedin this <tt>MetaContact</tt> */ public int getContactCount(); /** * Returns all protocol specific Contacts, encapsulated by this MetaContact and coming from the indicated ProtocolProviderService. If none of the contacts encapsulated by this MetaContact is originating from the specified provider then an empty iterator is returned. <p> Note to implementors: In order to prevent problems with concurrency, the <tt>Iterator</tt> returned by this method should not be over the actual list of contacts but rather over a copy of that list. <p> * @param provider a reference to the <tt>ProtocolProviderService</tt>whose contacts we'd like to get. * @return an <tt>Iterator</tt> over all contacts encapsulated in this<tt>MetaContact</tt> and originating from the specified provider. */ public Iterator<Contact> getContactsForProvider( ProtocolProviderService provider); /** * Returns all protocol specific Contacts, encapsulated by this MetaContact and supporting the given <tt>opSetClass</tt>. If none of the contacts encapsulated by this MetaContact is supporting the specified <tt>OperationSet</tt> class then an empty list is returned. <p> Note to implementors: In order to prevent problems with concurrency, the <tt>List</tt> returned by this method should not be the actual list of contacts but rather a copy of that list. <p> * @param opSetClass the operation for which the default contact is needed * @return a <tt>List</tt> of all contacts encapsulated in this<tt>MetaContact</tt> and supporting the specified <tt>OperationSet</tt> */ public List<Contact> getContactsForOperationSet( Class<? extends OperationSet> opSetClass); /** * Returns the MetaContactGroup currently containing this meta contact * @return a reference to the MetaContactGroup currently containing thismeta contact. */ public MetaContactGroup getParentMetaContactGroup(); /** * Returns a String identifier (the actual contents is left to implementations) that uniquely represents this <tt>MetaContact</tt> in the containing <tt>MetaContactList</tt> * @return String */ public String getMetaUID(); /** * Returns a characteristic display name that can be used when including this <tt>MetaContact</tt> in user interface. * @return a human readable String that represents this meta contact. */ public String getDisplayName(); /** * Returns the avatar of this contact, that can be used when including this <tt>MetaContact</tt> in user interface. * @return an avatar (e.g. user photo) of this contact. */ public byte[] getAvatar(); /** * Returns the avatar of this contact, that can be used when including this <tt>MetaContact</tt> in user interface. The isLazy parameter would tell the implementation if it could return the locally stored avatar or it should obtain the avatar right from the server. * @param isLazy Indicates if this method should return the locally storedavatar or it should obtain the avatar right from the server. * @return an avatar (e.g. user photo) of this contact. */ public byte[] getAvatar( boolean isLazy); /** * Returns a String representation of this <tt>MetaContact</tt>. * @return a String representation of this <tt>MetaContact</tt>. */ public String toString(); /** * Adds a custom detail to this contact. * @param name name of the detail. * @param value the value of the detail. */ public void addDetail( String name, String value); /** * Remove the given detail. * @param name of the detail to be removed. * @param value value of the detail to be removed. */ public void removeDetail( String name, String value); /** * Remove all details with given name. * @param name of the details to be removed. */ public void removeDetails( String name); /** * Change the detail. * @param name of the detail to be changed. * @param oldValue the old value of the detail. * @param newValue the new value of the detail. */ public void changeDetail( String name, String oldValue, String newValue); /** * Get all details with given name. * @param name the name of the details we are searching. * @return list of string values for the details with the given name. */ public List<String> getDetails( String name); /** * Gets the user data associated with this instance and a specific key. * @param key the key of the user data associated with this instance to beretrieved * @return an <tt>Object</tt> which represents the value associated withthis instance and the specified <tt>key</tt>; <tt>null</tt> if no association with the specified <tt>key</tt> exists in this instance */ public Object getData( Object key); /** * Sets a user-specific association in this instance in the form of a key-value pair. If the specified <tt>key</tt> is already associated in this instance with a value, the existing value is overwritten with the specified <tt>value</tt>. <p> The user-defined association created by this method and stored in this instance is not serialized by this instance and is thus only meant for runtime use. </p> <p> The storage of the user data is implementation-specific and is thus not guaranteed to be optimized for execution time and memory use. </p> * @param key the key to associate in this instance with the specified value * @param value the value to be associated in this instance with thespecified <tt>key</tt> */ public void setData( Object key, Object value); } /** * Sets the current meta contact. Meant to be used by plugin components that are interested of the current contact. The current contact could be the contact currently selected in the contact list or the contact for the currently selected chat, etc. It depends on the container, where this component is meant to be added. * @param metaContact the current meta contact */ public void setCurrentContact(MetaContact metaContact){ setCurrentContact((metaContact == null) ? null : metaContact.getDefaultContact()); } /** * Removes all entries in this contact list. */ public void removeAll(); @Override public Component add(Component comp){ if (comp instanceof JComponent) ((JComponent)comp).setAlignmentX(LEFT_ALIGNMENT); return super.add(comp); } /** * Returns a <tt>java.util.Iterator</tt> over all protocol specific <tt>Contacts</tt> encapsulated by this <tt>MetaContact</tt>. <p> In order to prevent problems with concurrency, the <tt>Iterator</tt> returned by this method is not over the actual list of contacts but over a copy of that list. <p> * @return a <tt>java.util.Iterator</tt> over all protocol specific<tt>Contact</tt>s that were registered as subcontacts for this <tt>MetaContact</tt> */ public Iterator<Contact> getContacts(){ return new LinkedList<Contact>(protoContacts).iterator(); } /** * Create an the add contact menu, taking into account the number of contact details available in the given <tt>sourceContact</tt>. * @param sourceContact the external source contact, for which we'd liketo create a menu * @return the add contact menu */ public static JMenuItem createAddContactMenu(SourceContact sourceContact){ JMenuItem addContactComponentTmp=null; List<ContactDetail> details=sourceContact.getContactDetails(OperationSetPersistentPresence.class); final String displayName=sourceContact.getDisplayName(); if (details.size() == 0) { return null; } if (details.size() == 1) { addContactComponentTmp=new JMenuItem(GuiActivator.getResources().getI18NString("service.gui.ADD_CONTACT"),new ImageIcon(ImageLoader.getImage(ImageLoader.ADD_CONTACT_16x16_ICON))); final ContactDetail detail=details.get(0); addContactComponentTmp.addActionListener(new ActionListener(){ public void actionPerformed( ActionEvent e){ showAddContactDialog(detail,displayName); } } ); } else if (details.size() > 1) { addContactComponentTmp=new JMenu(GuiActivator.getResources().getI18NString("service.gui.ADD_CONTACT")); Iterator<ContactDetail> detailsIter=details.iterator(); while (detailsIter.hasNext()) { final ContactDetail detail=detailsIter.next(); JMenuItem addMenuItem=new JMenuItem(detail.getDetail()); ((JMenu)addContactComponentTmp).add(addMenuItem); addMenuItem.addActionListener(new ActionListener(){ public void actionPerformed( ActionEvent e){ showAddContactDialog(detail,displayName); } } ); } } return addContactComponentTmp; }
public interface Contact { public String getAddress(); public String getDisplayName(); public byte[] getImage(); public PresenceStatus getPresenceStatus(); public ContactGroup getParentContactGroup(); public ProtocolProviderService getProtocolProvider(); public boolean isPersistent(); public boolean isResolved(); public String getPersistentData(); public String getStatusMessage(); public boolean supportResources(); public Collection<ContactResource> getResources(); public void addResourceListener( ContactResourceListener l); public void removeResourceListener( ContactResourceListener l); public String getPersistableAddress(); public boolean isMobile(); } public class HelpMenu extends SIPCommMenu implements ActionListener { private final PluginContainer pluginContainer; public HelpMenu( MainFrame mainFrame); public void actionPerformed( ActionEvent ev); } class OtrContactMenu implements ActionListener, ScOtrEngineListener, ScOtrKeyManagerListener { private final org.slf4j.Logger logger=org.slf4j.LoggerFactory.getLogger(OtrContactMenu.class); private static final String ACTION_COMMAND_AUTHENTICATE_BUDDY="AUTHENTICATE_BUDDY"; private static final String ACTION_COMMAND_CB_AUTO="CB_AUTO"; private static final String ACTION_COMMAND_CB_AUTO_ALL="CB_AUTO_ALL"; private static final String ACTION_COMMAND_CB_ENABLE="CB_ENABLE"; private static final String ACTION_COMMAND_CB_REQUIRE="CB_REQUIRE"; private static final String ACTION_COMMAND_CB_RESET="CB_RESET"; private static final String ACTION_COMMAND_END_OTR="END_OTR"; private static final String ACTION_COMMAND_REFRESH_OTR="REFRESH_OTR"; private static final String ACTION_COMMAND_START_OTR="START_OTR"; private final OtrContact contact; private final boolean inMacOSXScreenMenuBar; private OtrPolicy otrPolicy; private ScSessionStatus sessionStatus; private final JMenu parentMenu; private final SIPCommMenu separateMenu; public OtrContactMenu( OtrContact otrContact, boolean inMacOSXScreenMenuBar, JMenu menu, boolean isSeparateMenu); public void actionPerformed( ActionEvent e); public void contactPolicyChanged( Contact contact); public void contactVerificationStatusChanged( OtrContact otrContact); void dispose(); public void globalPolicyChanged(); private void buildMenu(); public void sessionStatusChanged(OtrContact otrContact); private void setSessionStatus(ScSessionStatus sessionStatus); private void setOtrPolicy(OtrPolicy otrPolicy); private void updateIcon(); public void multipleInstancesDetected(OtrContact contact); public void outgoingSessionChanged(OtrContact otrContact); } public interface MetaContact extends Comparable<MetaContact> { public Contact getDefaultContact(); public Contact getDefaultContact( Class<? extends OperationSet> operationSet); public Iterator<Contact> getContacts(); public Contact getContact( String contactAddress, ProtocolProviderService ownerProvider); public boolean containsContact( Contact protocolContact); public int getContactCount(); public Iterator<Contact> getContactsForProvider( ProtocolProviderService provider); public List<Contact> getContactsForOperationSet( Class<? extends OperationSet> opSetClass); public MetaContactGroup getParentMetaContactGroup(); public String getMetaUID(); public String getDisplayName(); public byte[] getAvatar(); public byte[] getAvatar( boolean isLazy); public String toString(); public void addDetail( String name, String value); public void removeDetail( String name, String value); public void removeDetails( String name); public void changeDetail( String name, String oldValue, String newValue); public List<String> getDetails( String name); public Object getData( Object key); public void setData( Object key, Object value); } /** * Sets the current meta contact. Meant to be used by plugin components that are interested of the current contact. The current contact could be the contact currently selected in the contact list or the contact for the currently selected chat, etc. It depends on the container, where this component is meant to be added. * @param metaContact the current meta contact */ public void setCurrentContact(MetaContact metaContact){ setCurrentContact((metaContact == null) ? null : metaContact.getDefaultContact()); } /** * Removes all entries in this contact list. */ public void removeAll(); @Override public Component add(Component comp){ if (comp instanceof JComponent) ((JComponent)comp).setAlignmentX(LEFT_ALIGNMENT); return super.add(comp); } /** * Returns a <tt>java.util.Iterator</tt> over all protocol specific <tt>Contacts</tt> encapsulated by this <tt>MetaContact</tt>. <p> In order to prevent problems with concurrency, the <tt>Iterator</tt> returned by this method is not over the actual list of contacts but over a copy of that list. <p> * @return a <tt>java.util.Iterator</tt> over all protocol specific<tt>Contact</tt>s that were registered as subcontacts for this <tt>MetaContact</tt> */ public Iterator<Contact> getContacts(){ return new LinkedList<Contact>(protoContacts).iterator(); } /** * Create an the add contact menu, taking into account the number of contact details available in the given <tt>sourceContact</tt>. * @param sourceContact the external source contact, for which we'd liketo create a menu * @return the add contact menu */ public static JMenuItem createAddContactMenu(SourceContact sourceContact){ JMenuItem addContactComponentTmp=null; List<ContactDetail> details=sourceContact.getContactDetails(OperationSetPersistentPresence.class); final String displayName=sourceContact.getDisplayName(); if (details.size() == 0) { return null; } if (details.size() == 1) { addContactComponentTmp=new JMenuItem(GuiActivator.getResources().getI18NString("service.gui.ADD_CONTACT"),new ImageIcon(ImageLoader.getImage(ImageLoader.ADD_CONTACT_16x16_ICON))); final ContactDetail detail=details.get(0); addContactComponentTmp.addActionListener(new ActionListener(){ public void actionPerformed( ActionEvent e){ showAddContactDialog(detail,displayName); } } ); } else if (details.size() > 1) { addContactComponentTmp=new JMenu(GuiActivator.getResources().getI18NString("service.gui.ADD_CONTACT")); Iterator<ContactDetail> detailsIter=details.iterator(); while (detailsIter.hasNext()) { final ContactDetail detail=detailsIter.next(); JMenuItem addMenuItem=new JMenuItem(detail.getDetail()); ((JMenu)addContactComponentTmp).add(addMenuItem); addMenuItem.addActionListener(new ActionListener(){ public void actionPerformed( ActionEvent e){ showAddContactDialog(detail,displayName); } } ); } } return addContactComponentTmp; }
{"types": [{"Contact": "Contact"}, {"JMenu": "HelpMenu"}, {"OtrContactMenu": "OtrContactMenu"}, {"MetaContact": "MetaContact"}], "methods": [{"setCurrentContact": "setCurrentContact"}, {"removeAll": "removeAll"}, {"add": "add"}, {"getContacts": "getContacts"}], "similar_methods": [{"createOtrContactMenus": "createAddContactMenu"}]}
[{"Contact": {"retrieved_name": "Contact", "raw_body": "/** \n * This class represents the notion of a Contact or Buddy, that is widely used in instant messaging today. From a protocol point of view, a contact is generally considered to be another user of the service that proposes the protocol. Instances of Contact could be used for delivery of presence notifications or when addressing instant messages.\n * @author Emil Ivov\n */\npublic interface Contact {\n /** \n * Returns a String that can be used for identifying the contact. The exact contents of the string depends on the protocol. In the case of SIP, for example, that would be the SIP uri (e.g. sip:alice@biloxi.com) in the case of icq - a UIN (12345653) and for AIM a screenname (mysname). Jabber (and hence Google) would be having e-mail like addresses.\n * @return a String id representing and uniquely identifying the contact.\n */\n public String getAddress();\n /** \n * Returns a String that could be used by any user interacting modules for referring to this contact. An alias is not necessarily unique but is often more human readable than an address (or id).\n * @return a String that can be used for referring to this contact wheninteracting with the user.\n */\n public String getDisplayName();\n /** \n * Returns a byte array containing an image (most often a photo or an avatar) that the contact uses as a representation.\n * @return byte[] an image representing the contact.\n */\n public byte[] getImage();\n /** \n * Returns the status of the contact as per the last status update we've received for it. Note that this method is not to perform any network operations and will simply return the status received in the last status update message. If you want a reliable way of retrieving someone's status, you should use the <tt>queryContactStatus()</tt> method in <tt>OperationSetPresence</tt>.\n * @return the PresenceStatus that we've received in the last status updatepertaining to this contact.\n */\n public PresenceStatus getPresenceStatus();\n /** \n * Returns a reference to the contact group that this contact is currently a child of or null if the underlying protocol does not support persistent presence.\n * @return a reference to the contact group that this contact is currentlya child of or null if the underlying protocol does not support persistent presence.\n */\n public ContactGroup getParentContactGroup();\n /** \n * Returns a reference to the protocol provider that created the contact.\n * @return a reference to an instance of the ProtocolProviderService\n */\n public ProtocolProviderService getProtocolProvider();\n /** \n * Determines whether or not this contact is being stored by the server. Non persistent contacts are common in the case of simple, non-persistent presence operation sets. They could however also be seen in persistent presence operation sets when for example we have received an event from someone not on our contact list. Non persistent contacts are volatile even when coming from a persistent presence op. set. They would only exist until the application is closed and will not be there next time it is loaded.\n * @return true if the contact is persistent and false otherwise.\n */\n public boolean isPersistent();\n /** \n * Determines whether or not this contact has been resolved against the server. Unresolved contacts are used when initially loading a contact list that has been stored in a local file until the presence operation set has managed to retrieve all the contact list from the server and has properly mapped contacts to their on-line buddies.\n * @return true if the contact has been resolved (mapped against a buddy)and false otherwise.\n */\n public boolean isResolved();\n /** \n * Returns a String that can be used to create a unresolved instance of this contact. Unresolved contacts are created through the createUnresolvedContact() method in the persistent presence operation set. The method may also return null if no such data is required and the contact address is sufficient for restoring the contact. <p>\n * @return A <tt>String</tt> that could be used to create a unresolvedinstance of this contact during a next run of the application, before establishing network connectivity or null if no such data is required.\n */\n public String getPersistentData();\n /** \n * Return the current status message of this contact.\n * @return the current status message\n */\n public String getStatusMessage();\n /** \n * Indicates if this contact supports resources.\n * @return <tt>true</tt> if this contact supports resources, <tt>false</tt>otherwise\n */\n public boolean supportResources();\n /** \n * Returns a collection of resources supported by this contact or null if it doesn't support resources.\n * @return a collection of resources supported by this contact or nullif it doesn't support resources\n */\n public Collection<ContactResource> getResources();\n /** \n * Adds the given <tt>ContactResourceListener</tt> to listen for events related to contact resources changes.\n * @param l the <tt>ContactResourceListener</tt> to add\n */\n public void addResourceListener( ContactResourceListener l);\n /** \n * Removes the given <tt>ContactResourceListener</tt> listening for events related to contact resources changes.\n * @param l the <tt>ContactResourceListener</tt> to rmove\n */\n public void removeResourceListener( ContactResourceListener l);\n /** \n * Returns the persistent contact address.\n * @return the address of the contact.\n */\n public String getPersistableAddress();\n /** \n * Whether contact is mobile one. Logged in only from mobile device.\n * @return whether contact is mobile one.\n */\n public boolean isMobile();\n}\n", "raw_body_no_cmt": "public interface Contact {\n public String getAddress();\n public String getDisplayName();\n public byte[] getImage();\n public PresenceStatus getPresenceStatus();\n public ContactGroup getParentContactGroup();\n public ProtocolProviderService getProtocolProvider();\n public boolean isPersistent();\n public boolean isResolved();\n public String getPersistentData();\n public String getStatusMessage();\n public boolean supportResources();\n public Collection<ContactResource> getResources();\n public void addResourceListener( ContactResourceListener l);\n public void removeResourceListener( ContactResourceListener l);\n public String getPersistableAddress();\n public boolean isMobile();\n}\n"}}, {"JMenu": {"retrieved_name": "HelpMenu", "raw_body": "/** \n * The <tt>HelpMenu</tt> is a menu in the main application menu bar.\n * @author Yana Stamcheva\n * @author Thomas Hofer\n * @author Lyubomir Marinov\n */\npublic class HelpMenu extends SIPCommMenu implements ActionListener {\n /** \n * The <tt>PluginContainer</tt> which implements the logic related to dealing with <tt>PluginComponent</tt>s on behalf of this <tt>HelpMenu</tt>.\n */\n private final PluginContainer pluginContainer;\n /** \n * Creates an instance of <tt>HelpMenu</tt>.\n * @param mainFrame the parent window\n */\n public HelpMenu( MainFrame mainFrame);\n /** \n * Handles the <tt>ActionEvent</tt> when one of the menu items is selected.\n * @param ev\n */\n @Override public void actionPerformed( ActionEvent ev);\n}\n", "raw_body_no_cmt": "public class HelpMenu extends SIPCommMenu implements ActionListener {\n private final PluginContainer pluginContainer;\n public HelpMenu( MainFrame mainFrame);\n public void actionPerformed( ActionEvent ev);\n}\n"}}, {"OtrContactMenu": {"retrieved_name": "OtrContactMenu", "raw_body": "/** \n * A special {@link JMenu} that holds the menu items for controlling theOff-the-Record functionality for a specific contact.\n * @author George Politis\n * @author Lyubomir Marinov\n * @author Marin Dzhigarov\n */\nclass OtrContactMenu implements ActionListener, ScOtrEngineListener, ScOtrKeyManagerListener {\n private final org.slf4j.Logger logger=org.slf4j.LoggerFactory.getLogger(OtrContactMenu.class);\n private static final String ACTION_COMMAND_AUTHENTICATE_BUDDY=\"AUTHENTICATE_BUDDY\";\n private static final String ACTION_COMMAND_CB_AUTO=\"CB_AUTO\";\n private static final String ACTION_COMMAND_CB_AUTO_ALL=\"CB_AUTO_ALL\";\n private static final String ACTION_COMMAND_CB_ENABLE=\"CB_ENABLE\";\n private static final String ACTION_COMMAND_CB_REQUIRE=\"CB_REQUIRE\";\n private static final String ACTION_COMMAND_CB_RESET=\"CB_RESET\";\n private static final String ACTION_COMMAND_END_OTR=\"END_OTR\";\n private static final String ACTION_COMMAND_REFRESH_OTR=\"REFRESH_OTR\";\n private static final String ACTION_COMMAND_START_OTR=\"START_OTR\";\n private final OtrContact contact;\n /** \n * The indicator which determines whether this <tt>JMenu</tt> is displayed in the Mac OS X screen menu bar and thus should work around the known problem of PopupMenuListener not being invoked.\n */\n private final boolean inMacOSXScreenMenuBar;\n /** \n * We keep this variable so we can determine if the policy has changed or not in {@link OtrContactMenu#setOtrPolicy(OtrPolicy)}.\n */\n private OtrPolicy otrPolicy;\n private ScSessionStatus sessionStatus;\n private final JMenu parentMenu;\n private final SIPCommMenu separateMenu;\n /** \n * The OtrContactMenu constructor.\n * @param otrContact the OtrContact this menu refers to.\n * @param inMacOSXScreenMenuBar <tt>true</tt> if the new menu is to bedisplayed in the Mac OS X screen menu bar; <tt>false</tt>, otherwise\n * @param menu the parent menu\n */\n public OtrContactMenu( OtrContact otrContact, boolean inMacOSXScreenMenuBar, JMenu menu, boolean isSeparateMenu);\n public void actionPerformed( ActionEvent e);\n public void contactPolicyChanged( Contact contact);\n public void contactVerificationStatusChanged( OtrContact otrContact);\n /** \n * Disposes of this instance by making it available for garage collection e.g. removes the listeners it has installed on global instances such as <tt>OtrActivator#scOtrEngine</tt> and <tt>OtrActivator#scOtrKeyManager</tt>.\n */\n void dispose();\n public void globalPolicyChanged();\n /** \n * Rebuilds own menuitems according to {@link OtrContactMenu#sessionStatus}and the {@link OtrPolicy} for {@link OtrContactMenu#contact}.\n */\n private void buildMenu();\npublic void sessionStatusChanged(OtrContact otrContact);\n/** \n * Sets the {@link OtrContactMenu#sessionStatus} value, updates the menuicon and, if necessary, rebuilds the menuitems to match the passed in sessionStatus.\n * @param sessionStatus the {@link ScSessionStatus}.\n */\nprivate void setSessionStatus(ScSessionStatus sessionStatus);\n/** \n * Sets the {@link OtrContactMenu#otrPolicy} and, if necessary, rebuilds themenuitems to match the passed in otrPolicy.\n * @param otrPolicy\n */\nprivate void setOtrPolicy(OtrPolicy otrPolicy);\n/** \n * Updates the menu icon based on {@link OtrContactMenu#sessionStatus}value.\n */\nprivate void updateIcon();\n@Override public void multipleInstancesDetected(OtrContact contact);\n@Override public void outgoingSessionChanged(OtrContact otrContact);\n}\n", "raw_body_no_cmt": "class OtrContactMenu implements ActionListener, ScOtrEngineListener, ScOtrKeyManagerListener {\n private final org.slf4j.Logger logger=org.slf4j.LoggerFactory.getLogger(OtrContactMenu.class);\n private static final String ACTION_COMMAND_AUTHENTICATE_BUDDY=\"AUTHENTICATE_BUDDY\";\n private static final String ACTION_COMMAND_CB_AUTO=\"CB_AUTO\";\n private static final String ACTION_COMMAND_CB_AUTO_ALL=\"CB_AUTO_ALL\";\n private static final String ACTION_COMMAND_CB_ENABLE=\"CB_ENABLE\";\n private static final String ACTION_COMMAND_CB_REQUIRE=\"CB_REQUIRE\";\n private static final String ACTION_COMMAND_CB_RESET=\"CB_RESET\";\n private static final String ACTION_COMMAND_END_OTR=\"END_OTR\";\n private static final String ACTION_COMMAND_REFRESH_OTR=\"REFRESH_OTR\";\n private static final String ACTION_COMMAND_START_OTR=\"START_OTR\";\n private final OtrContact contact;\n private final boolean inMacOSXScreenMenuBar;\n private OtrPolicy otrPolicy;\n private ScSessionStatus sessionStatus;\n private final JMenu parentMenu;\n private final SIPCommMenu separateMenu;\n public OtrContactMenu( OtrContact otrContact, boolean inMacOSXScreenMenuBar, JMenu menu, boolean isSeparateMenu);\n public void actionPerformed( ActionEvent e);\n public void contactPolicyChanged( Contact contact);\n public void contactVerificationStatusChanged( OtrContact otrContact);\n void dispose();\n public void globalPolicyChanged();\n private void buildMenu();\npublic void sessionStatusChanged(OtrContact otrContact);\nprivate void setSessionStatus(ScSessionStatus sessionStatus);\nprivate void setOtrPolicy(OtrPolicy otrPolicy);\nprivate void updateIcon();\npublic void multipleInstancesDetected(OtrContact contact);\npublic void outgoingSessionChanged(OtrContact otrContact);\n}\n"}}, {"MetaContact": {"retrieved_name": "MetaContact", "raw_body": "/** \n * A MetaContact is an abstraction used for merging multiple Contacts (most often) belonging to different <tt>ProtocolProvider</tt>s. <p> Instances of a MetaContact are read-only objects that cannot be modified directly but only through the corresponding MetaContactListService. </p>\n * @author Emil Ivov\n * @author Lubomir Marinov\n */\npublic interface MetaContact extends Comparable<MetaContact> {\n /** \n * Returns the default protocol specific <tt>Contact</tt> to use when communicating with this <tt>MetaContact</tt>.\n * @return the default <tt>Contact</tt> to use when communicating withthis <tt>MetaContact</tt>\n */\n public Contact getDefaultContact();\n /** \n * Returns the default protocol specific <tt>Contact</tt> to use with this <tt>MetaContact</tt> for a precise operation (IM, call, ...).\n * @param operationSet the operation for which the default contact is needed\n * @return the default contact for the specified operation.\n */\n public Contact getDefaultContact( Class<? extends OperationSet> operationSet);\n /** \n * Returns a <tt>java.util.Iterator</tt> with all protocol specific <tt>Contacts</tt> encapsulated by this <tt>MetaContact</tt>. <p> Note to implementors: In order to prevent problems with concurrency, the <tt>Iterator</tt> returned by this method should not be over the actual list of contacts but rather over a copy of that list. <p>\n * @return a <tt>java.util.Iterator</tt> containing all protocol specific<tt>Contact</tt>s that were registered as subcontacts for this <tt>MetaContact</tt>\n */\n public Iterator<Contact> getContacts();\n /** \n * Returns a contact encapsulated by this meta contact, having the specified contactAddress and coming from the indicated ownerProvider.\n * @param contactAddress the address of the contact who we're looking for.\n * @param ownerProvider a reference to the ProtocolProviderService thatthe contact we're looking for belongs to.\n * @return a reference to a <tt>Contact</tt>, encapsulated by thisMetaContact, carrying the specified address and originating from the specified ownerProvider or null if no such contact exists..\n */\n public Contact getContact( String contactAddress, ProtocolProviderService ownerProvider);\n /** \n * Returns <tt>true</tt> if the given <tt>protocolContact</tt> is contained in this <tt>MetaContact</tt>, otherwise - returns <tt>false</tt>.\n * @param protocolContact the <tt>Contact</tt> we're looking for\n * @return <tt>true</tt> if the given <tt>protocolContact</tt> is containedin this <tt>MetaContact</tt>, otherwise - returns <tt>false</tt>\n */\n public boolean containsContact( Contact protocolContact);\n /** \n * Returns the number of protocol speciic <tt>Contact</tt>s that this <tt>MetaContact</tt> contains.\n * @return an int indicating the number of protocol specific contacts mergedin this <tt>MetaContact</tt>\n */\n public int getContactCount();\n /** \n * Returns all protocol specific Contacts, encapsulated by this MetaContact and coming from the indicated ProtocolProviderService. If none of the contacts encapsulated by this MetaContact is originating from the specified provider then an empty iterator is returned. <p> Note to implementors: In order to prevent problems with concurrency, the <tt>Iterator</tt> returned by this method should not be over the actual list of contacts but rather over a copy of that list. <p>\n * @param provider a reference to the <tt>ProtocolProviderService</tt>whose contacts we'd like to get.\n * @return an <tt>Iterator</tt> over all contacts encapsulated in this<tt>MetaContact</tt> and originating from the specified provider.\n */\n public Iterator<Contact> getContactsForProvider( ProtocolProviderService provider);\n /** \n * Returns all protocol specific Contacts, encapsulated by this MetaContact and supporting the given <tt>opSetClass</tt>. If none of the contacts encapsulated by this MetaContact is supporting the specified <tt>OperationSet</tt> class then an empty list is returned. <p> Note to implementors: In order to prevent problems with concurrency, the <tt>List</tt> returned by this method should not be the actual list of contacts but rather a copy of that list. <p>\n * @param opSetClass the operation for which the default contact is needed\n * @return a <tt>List</tt> of all contacts encapsulated in this<tt>MetaContact</tt> and supporting the specified <tt>OperationSet</tt>\n */\n public List<Contact> getContactsForOperationSet( Class<? extends OperationSet> opSetClass);\n /** \n * Returns the MetaContactGroup currently containing this meta contact\n * @return a reference to the MetaContactGroup currently containing thismeta contact.\n */\n public MetaContactGroup getParentMetaContactGroup();\n /** \n * Returns a String identifier (the actual contents is left to implementations) that uniquely represents this <tt>MetaContact</tt> in the containing <tt>MetaContactList</tt>\n * @return String\n */\n public String getMetaUID();\n /** \n * Returns a characteristic display name that can be used when including this <tt>MetaContact</tt> in user interface.\n * @return a human readable String that represents this meta contact.\n */\n public String getDisplayName();\n /** \n * Returns the avatar of this contact, that can be used when including this <tt>MetaContact</tt> in user interface.\n * @return an avatar (e.g. user photo) of this contact.\n */\n public byte[] getAvatar();\n /** \n * Returns the avatar of this contact, that can be used when including this <tt>MetaContact</tt> in user interface. The isLazy parameter would tell the implementation if it could return the locally stored avatar or it should obtain the avatar right from the server.\n * @param isLazy Indicates if this method should return the locally storedavatar or it should obtain the avatar right from the server.\n * @return an avatar (e.g. user photo) of this contact.\n */\n public byte[] getAvatar( boolean isLazy);\n /** \n * Returns a String representation of this <tt>MetaContact</tt>.\n * @return a String representation of this <tt>MetaContact</tt>.\n */\n public String toString();\n /** \n * Adds a custom detail to this contact.\n * @param name name of the detail.\n * @param value the value of the detail.\n */\n public void addDetail( String name, String value);\n /** \n * Remove the given detail.\n * @param name of the detail to be removed.\n * @param value value of the detail to be removed.\n */\n public void removeDetail( String name, String value);\n /** \n * Remove all details with given name.\n * @param name of the details to be removed.\n */\n public void removeDetails( String name);\n /** \n * Change the detail.\n * @param name of the detail to be changed.\n * @param oldValue the old value of the detail.\n * @param newValue the new value of the detail.\n */\n public void changeDetail( String name, String oldValue, String newValue);\n /** \n * Get all details with given name.\n * @param name the name of the details we are searching.\n * @return list of string values for the details with the given name.\n */\n public List<String> getDetails( String name);\n /** \n * Gets the user data associated with this instance and a specific key.\n * @param key the key of the user data associated with this instance to beretrieved\n * @return an <tt>Object</tt> which represents the value associated withthis instance and the specified <tt>key</tt>; <tt>null</tt> if no association with the specified <tt>key</tt> exists in this instance\n */\n public Object getData( Object key);\n /** \n * Sets a user-specific association in this instance in the form of a key-value pair. If the specified <tt>key</tt> is already associated in this instance with a value, the existing value is overwritten with the specified <tt>value</tt>. <p> The user-defined association created by this method and stored in this instance is not serialized by this instance and is thus only meant for runtime use. </p> <p> The storage of the user data is implementation-specific and is thus not guaranteed to be optimized for execution time and memory use. </p>\n * @param key the key to associate in this instance with the specified value\n * @param value the value to be associated in this instance with thespecified <tt>key</tt>\n */\n public void setData( Object key, Object value);\n}\n", "raw_body_no_cmt": "public interface MetaContact extends Comparable<MetaContact> {\n public Contact getDefaultContact();\n public Contact getDefaultContact( Class<? extends OperationSet> operationSet);\n public Iterator<Contact> getContacts();\n public Contact getContact( String contactAddress, ProtocolProviderService ownerProvider);\n public boolean containsContact( Contact protocolContact);\n public int getContactCount();\n public Iterator<Contact> getContactsForProvider( ProtocolProviderService provider);\n public List<Contact> getContactsForOperationSet( Class<? extends OperationSet> opSetClass);\n public MetaContactGroup getParentMetaContactGroup();\n public String getMetaUID();\n public String getDisplayName();\n public byte[] getAvatar();\n public byte[] getAvatar( boolean isLazy);\n public String toString();\n public void addDetail( String name, String value);\n public void removeDetail( String name, String value);\n public void removeDetails( String name);\n public void changeDetail( String name, String oldValue, String newValue);\n public List<String> getDetails( String name);\n public Object getData( Object key);\n public void setData( Object key, Object value);\n}\n"}}]
[{"setCurrentContact": {"retrieved_name": "setCurrentContact", "raw_body": "/** \n * Sets the current meta contact. Meant to be used by plugin components that are interested of the current contact. The current contact could be the contact currently selected in the contact list or the contact for the currently selected chat, etc. It depends on the container, where this component is meant to be added.\n * @param metaContact the current meta contact\n */\npublic void setCurrentContact(MetaContact metaContact){\n setCurrentContact((metaContact == null) ? null : metaContact.getDefaultContact());\n}\n"}}, {"removeAll": {"retrieved_name": "removeAll", "raw_body": "/** \n * Removes all entries in this contact list.\n */\npublic void removeAll();\n"}}, {"add": {"retrieved_name": "add", "raw_body": "@Override public Component add(Component comp){\n if (comp instanceof JComponent) ((JComponent)comp).setAlignmentX(LEFT_ALIGNMENT);\n return super.add(comp);\n}\n"}}, {"getContacts": {"retrieved_name": "getContacts", "raw_body": "/** \n * Returns a <tt>java.util.Iterator</tt> over all protocol specific <tt>Contacts</tt> encapsulated by this <tt>MetaContact</tt>. <p> In order to prevent problems with concurrency, the <tt>Iterator</tt> returned by this method is not over the actual list of contacts but over a copy of that list. <p>\n * @return a <tt>java.util.Iterator</tt> over all protocol specific<tt>Contact</tt>s that were registered as subcontacts for this <tt>MetaContact</tt>\n */\npublic Iterator<Contact> getContacts(){\n return new LinkedList<Contact>(protoContacts).iterator();\n}\n"}}]
[{"createOtrContactMenus": {"retrieved_name": "createAddContactMenu", "raw_body": "/** \n * Create an the add contact menu, taking into account the number of contact details available in the given <tt>sourceContact</tt>.\n * @param sourceContact the external source contact, for which we'd liketo create a menu\n * @return the add contact menu\n */\npublic static JMenuItem createAddContactMenu(SourceContact sourceContact){\n JMenuItem addContactComponentTmp=null;\n List<ContactDetail> details=sourceContact.getContactDetails(OperationSetPersistentPresence.class);\n final String displayName=sourceContact.getDisplayName();\n if (details.size() == 0) {\n return null;\n }\n if (details.size() == 1) {\n addContactComponentTmp=new JMenuItem(GuiActivator.getResources().getI18NString(\"service.gui.ADD_CONTACT\"),new ImageIcon(ImageLoader.getImage(ImageLoader.ADD_CONTACT_16x16_ICON)));\n final ContactDetail detail=details.get(0);\n addContactComponentTmp.addActionListener(new ActionListener(){\n public void actionPerformed( ActionEvent e){\n showAddContactDialog(detail,displayName);\n }\n }\n);\n }\n else if (details.size() > 1) {\n addContactComponentTmp=new JMenu(GuiActivator.getResources().getI18NString(\"service.gui.ADD_CONTACT\"));\n Iterator<ContactDetail> detailsIter=details.iterator();\n while (detailsIter.hasNext()) {\n final ContactDetail detail=detailsIter.next();\n JMenuItem addMenuItem=new JMenuItem(detail.getDetail());\n ((JMenu)addContactComponentTmp).add(addMenuItem);\n addMenuItem.addActionListener(new ActionListener(){\n public void actionPerformed( ActionEvent e){\n showAddContactDialog(detail,displayName);\n }\n }\n);\n }\n }\n return addContactComponentTmp;\n}\n"}}]
docker-java_docker-java
docker-java/docker-java-api/src/main/java/com/github/dockerjava/api/model/Device.java
Device
parse
class Device extends DockerObject implements Serializable { private static final long serialVersionUID = 1L; @JsonProperty("CgroupPermissions") private String cGroupPermissions = ""; @JsonProperty("PathOnHost") private String pathOnHost = null; @JsonProperty("PathInContainer") private String pathInContainer = null; public Device() { } public Device(String cGroupPermissions, String pathInContainer, String pathOnHost) { requireNonNull(cGroupPermissions, "cGroupPermissions is null"); requireNonNull(pathInContainer, "pathInContainer is null"); requireNonNull(pathOnHost, "pathOnHost is null"); this.cGroupPermissions = cGroupPermissions; this.pathInContainer = pathInContainer; this.pathOnHost = pathOnHost; } public String getcGroupPermissions() { return cGroupPermissions; } public String getPathInContainer() { return pathInContainer; } public String getPathOnHost() { return pathOnHost; } /** * @link https://github.com/docker/docker/blob/6b4a46f28266031ce1a1315f17fb69113a06efe1/runconfig/opts/parse_test.go#L468 */ @Nonnull public static Device parse(@Nonnull String deviceStr) {<FILL_FUNCTION_BODY>} /** * ValidDeviceMode checks if the mode for device is valid or not. * Valid mode is a composition of r (read), w (write), and m (mknod). * * @link https://github.com/docker/docker/blob/6b4a46f28266031ce1a1315f17fb69113a06efe1/runconfig/opts/parse.go#L796 */ private static boolean validDeviceMode(String deviceMode) { Map<String, Boolean> validModes = new HashMap<>(3); validModes.put("r", true); validModes.put("w", true); validModes.put("m", true); if (deviceMode == null || deviceMode.length() == 0) { return false; } for (char ch : deviceMode.toCharArray()) { final String mode = String.valueOf(ch); if (!Boolean.TRUE.equals(validModes.get(mode))) { return false; // wrong mode } validModes.put(mode, false); } return true; } }
String src = ""; String dst = ""; String permissions = "rwm"; final String[] arr = deviceStr.trim().split(":"); // java String.split() returns wrong length, use tokenizer instead switch (new StringTokenizer(deviceStr, ":").countTokens()) { case 3: { // Mismatches docker code logic. While there is no validations after parsing, checking heregit if (validDeviceMode(arr[2])) { permissions = arr[2]; } else { throw new IllegalArgumentException("Invalid device specification: " + deviceStr); } } case 2: { if (validDeviceMode(arr[1])) { permissions = arr[1]; } else { dst = arr[1]; } } case 1: { src = arr[0]; break; } default: { throw new IllegalArgumentException("Invalid device specification: " + deviceStr); } } if (dst == null || dst.length() == 0) { dst = src; } return new Device(permissions, dst, src);
/** * @see DockerObjectAccessor */ public abstract class DockerObject { HashMap<String,Object> rawValues=new HashMap<>(); @JsonAnyGetter public Map<String,Object> getRawValues(); }
final String[] deviceParts = deviceStr.split(":"); if (deviceParts.length != 3) { throw new IllegalArgumentException("Invalid device format: " + deviceStr); } final String devicePathInContainer = deviceParts[0]; final String devicePathOnHost = deviceParts[1]; final String deviceCGroupPermissions = deviceParts[2]; if (!validDeviceMode(deviceCGroupPermissions)) { throw new IllegalArgumentException("Invalid device mode: " + deviceCGroupPermissions); } return new Device(deviceCGroupPermissions, devicePathInContainer, devicePathOnHost);
[]
[ "split" ]
[]
[ "length", "split", "countTokens", "trim" ]
{ "methods": [ "split" ], "similar_methods": [ "parse" ], "types": [] }
public long skip(long n) throws IOException { return delegate.skip(n); } /** * Parses a string to an {@link InternetProtocol}. * @param serialized the protocol, e.g. <code>tcp</code> or <code>TCP</code> * @return an {@link InternetProtocol} described by the string * @throws IllegalArgumentException if the argument cannot be parsed */ public static InternetProtocol parse(String serialized) throws IllegalArgumentException { try { return valueOf(serialized.toUpperCase()); } catch ( Exception e) { throw new IllegalArgumentException("Error parsing Protocol '" + serialized + "'"); } }
public long skip(long n) throws IOException { return delegate.skip(n); } /** * Parses a string to an {@link InternetProtocol}. * @param serialized the protocol, e.g. <code>tcp</code> or <code>TCP</code> * @return an {@link InternetProtocol} described by the string * @throws IllegalArgumentException if the argument cannot be parsed */ public static InternetProtocol parse(String serialized) throws IllegalArgumentException { try { return valueOf(serialized.toUpperCase()); } catch ( Exception e) { throw new IllegalArgumentException("Error parsing Protocol '" + serialized + "'"); } }
{"methods": [{"split": "skip"}], "similar_methods": [{"parse": "parse"}]}
[]
[{"split": {"retrieved_name": "skip", "raw_body": "public long skip(long n) throws IOException {\n return delegate.skip(n);\n}\n"}}]
[{"parse": {"retrieved_name": "parse", "raw_body": "/** \n * Parses a string to an {@link InternetProtocol}.\n * @param serialized the protocol, e.g. <code>tcp</code> or <code>TCP</code>\n * @return an {@link InternetProtocol} described by the string\n * @throws IllegalArgumentException if the argument cannot be parsed\n */\npublic static InternetProtocol parse(String serialized) throws IllegalArgumentException {\n try {\n return valueOf(serialized.toUpperCase());\n }\n catch ( Exception e) {\n throw new IllegalArgumentException(\"Error parsing Protocol '\" + serialized + \"'\");\n }\n}\n"}}]
subhra74_snowflake
snowflake/muon-app/src/main/java/muon/app/ui/components/session/utilpage/services/ServiceTableCellRenderer.java
ServiceTableCellRenderer
getTableCellRendererComponent
class ServiceTableCellRenderer extends JLabel implements TableCellRenderer { public ServiceTableCellRenderer() { setText("HHH"); setBorder(new EmptyBorder(5, 5, 5, 5)); setOpaque(true); } @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {<FILL_FUNCTION_BODY>} }
setText(value == null ? "" : value.toString()); setBackground(isSelected ? table.getSelectionBackground() : table.getBackground()); setForeground(isSelected ? table.getSelectionForeground() : table.getForeground()); return this;
Service service = (Service) value; setText(service.getName()); return this;
[ "JTable", "Service" ]
[ "getName" ]
[ "JTable" ]
[ "getSelectionForeground", "getForeground", "toString", "getSelectionBackground", "getBackground" ]
{ "methods": [ "getName" ], "similar_methods": [ "getTableCellRendererComponent" ], "types": [ "JTable", "Service" ] }
public class SearchTableRenderer implements TableCellRenderer { private JLabel label; private JPanel panel; private SearchTableModel model; private JLabel textLabel, iconLabel; public SearchTableRenderer( SearchTableModel model); public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column); } public class ServiceEntry { private String name; private String unitStatus; private String desc; private String unitFileStatus; public ServiceEntry( String name, String unitStatus, String desc, String unitFileStatus); public ServiceEntry(); public String getName(); public void setName( String name); public String getUnitStatus(); public void setUnitStatus( String unitStatus); public String getDesc(); public void setDesc( String desc); public String getUnitFileStatus(); public void setUnitFileStatus( String unitFileStatus); @Override public String toString(); } @Override public String getName(){ return this.ssh.getInfo().getName(); } @Override public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column){ setBackground(isSelected ? table.getSelectionBackground() : table.getBackground()); setForeground(isSelected ? table.getSelectionForeground() : table.getForeground()); if (column == 3) { double mem=((Float)value) * 1024; setText(FormatUtils.humanReadableByteCount((long)mem,true)); } else { setText(value.toString()); } return this; }
public class SearchTableRenderer implements TableCellRenderer { private JLabel label; private JPanel panel; private SearchTableModel model; private JLabel textLabel, iconLabel; public SearchTableRenderer( SearchTableModel model); public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column); } public class ServiceEntry { private String name; private String unitStatus; private String desc; private String unitFileStatus; public ServiceEntry( String name, String unitStatus, String desc, String unitFileStatus); public ServiceEntry(); public String getName(); public void setName( String name); public String getUnitStatus(); public void setUnitStatus( String unitStatus); public String getDesc(); public void setDesc( String desc); public String getUnitFileStatus(); public void setUnitFileStatus( String unitFileStatus); public String toString(); } @Override public String getName(){ return this.ssh.getInfo().getName(); } @Override public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column){ setBackground(isSelected ? table.getSelectionBackground() : table.getBackground()); setForeground(isSelected ? table.getSelectionForeground() : table.getForeground()); if (column == 3) { double mem=((Float)value) * 1024; setText(FormatUtils.humanReadableByteCount((long)mem,true)); } else { setText(value.toString()); } return this; }
{"types": [{"JTable": "SearchTableRenderer"}, {"Service": "ServiceEntry"}], "methods": [{"getName": "getName"}], "similar_methods": [{"getTableCellRendererComponent": "getTableCellRendererComponent"}]}
[{"JTable": {"retrieved_name": "SearchTableRenderer", "raw_body": "public class SearchTableRenderer implements TableCellRenderer {\n private JLabel label;\n private JPanel panel;\n private SearchTableModel model;\n private JLabel textLabel, iconLabel;\n public SearchTableRenderer( SearchTableModel model);\n public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column);\n}\n", "raw_body_no_cmt": "public class SearchTableRenderer implements TableCellRenderer {\n private JLabel label;\n private JPanel panel;\n private SearchTableModel model;\n private JLabel textLabel, iconLabel;\n public SearchTableRenderer( SearchTableModel model);\n public Component getTableCellRendererComponent( JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column);\n}\n"}}, {"Service": {"retrieved_name": "ServiceEntry", "raw_body": "public class ServiceEntry {\n private String name;\n private String unitStatus;\n private String desc;\n private String unitFileStatus;\n public ServiceEntry( String name, String unitStatus, String desc, String unitFileStatus);\n public ServiceEntry();\n public String getName();\n public void setName( String name);\n public String getUnitStatus();\n public void setUnitStatus( String unitStatus);\n public String getDesc();\n public void setDesc( String desc);\n public String getUnitFileStatus();\n public void setUnitFileStatus( String unitFileStatus);\n @Override public String toString();\n}\n", "raw_body_no_cmt": "public class ServiceEntry {\n private String name;\n private String unitStatus;\n private String desc;\n private String unitFileStatus;\n public ServiceEntry( String name, String unitStatus, String desc, String unitFileStatus);\n public ServiceEntry();\n public String getName();\n public void setName( String name);\n public String getUnitStatus();\n public void setUnitStatus( String unitStatus);\n public String getDesc();\n public void setDesc( String desc);\n public String getUnitFileStatus();\n public void setUnitFileStatus( String unitFileStatus);\n public String toString();\n}\n"}}]
[{"getName": {"retrieved_name": "getName", "raw_body": "@Override public String getName(){\n return this.ssh.getInfo().getName();\n}\n"}}]
[{"getTableCellRendererComponent": {"retrieved_name": "getTableCellRendererComponent", "raw_body": "@Override public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected,boolean hasFocus,int row,int column){\n setBackground(isSelected ? table.getSelectionBackground() : table.getBackground());\n setForeground(isSelected ? table.getSelectionForeground() : table.getForeground());\n if (column == 3) {\n double mem=((Float)value) * 1024;\n setText(FormatUtils.humanReadableByteCount((long)mem,true));\n }\n else {\n setText(value.toString());\n }\n return this;\n}\n"}}]
DerekYRC_mini-spring
mini-spring/src/main/java/org/springframework/aop/aspectj/AspectJExpressionPointcutAdvisor.java
AspectJExpressionPointcutAdvisor
getPointcut
class AspectJExpressionPointcutAdvisor implements PointcutAdvisor { private AspectJExpressionPointcut pointcut; private Advice advice; private String expression; public void setExpression(String expression) { this.expression = expression; } @Override public Pointcut getPointcut() {<FILL_FUNCTION_BODY>} @Override public Advice getAdvice() { return advice; } public void setAdvice(Advice advice) { this.advice = advice; } }
if (pointcut == null) { pointcut = new AspectJExpressionPointcut(expression); } return pointcut;
if (pointcut == null) { pointcut = new AspectJExpressionPointcut(); pointcut.setExpression(expression); } return pointcut;
[ "AspectJExpressionPointcut" ]
[ "setExpression" ]
[ "AspectJExpressionPointcut" ]
[]
{ "methods": [ "setExpression" ], "similar_methods": [ "getPointcut" ], "types": [ "AspectJExpressionPointcut" ] }
/** * @author derekyi * @date 2020/12/5 */ public class AspectJExpressionPointcut implements Pointcut, ClassFilter, MethodMatcher { private static final Set<PointcutPrimitive> SUPPORTED_PRIMITIVES=new HashSet<PointcutPrimitive>(); static { SUPPORTED_PRIMITIVES.add(PointcutPrimitive.EXECUTION); } private final PointcutExpression pointcutExpression; public AspectJExpressionPointcut( String expression); @Override public boolean matches( Class<?> clazz); @Override public boolean matches( Method method, Class<?> targetClass); @Override public ClassFilter getClassFilter(); @Override public MethodMatcher getMethodMatcher(); } public void setName(String name){ this.name=name; } Pointcut getPointcut();
public class AspectJExpressionPointcut implements Pointcut, ClassFilter, MethodMatcher { private static final Set<PointcutPrimitive> SUPPORTED_PRIMITIVES=new HashSet<PointcutPrimitive>(); static { SUPPORTED_PRIMITIVES.add(PointcutPrimitive.EXECUTION); } private final PointcutExpression pointcutExpression; public AspectJExpressionPointcut( String expression); public boolean matches( Class<?> clazz); public boolean matches( Method method, Class<?> targetClass); public ClassFilter getClassFilter(); public MethodMatcher getMethodMatcher(); } public void setName(String name){ this.name=name; } Pointcut getPointcut();
{"types": [{"AspectJExpressionPointcut": "AspectJExpressionPointcut"}], "methods": [{"setExpression": "setName"}], "similar_methods": [{"getPointcut": "getPointcut"}]}
[{"AspectJExpressionPointcut": {"retrieved_name": "AspectJExpressionPointcut", "raw_body": "/** \n * @author derekyi\n * @date 2020/12/5\n */\npublic class AspectJExpressionPointcut implements Pointcut, ClassFilter, MethodMatcher {\n private static final Set<PointcutPrimitive> SUPPORTED_PRIMITIVES=new HashSet<PointcutPrimitive>();\nstatic {\n SUPPORTED_PRIMITIVES.add(PointcutPrimitive.EXECUTION);\n }\n private final PointcutExpression pointcutExpression;\n public AspectJExpressionPointcut( String expression);\n @Override public boolean matches( Class<?> clazz);\n @Override public boolean matches( Method method, Class<?> targetClass);\n @Override public ClassFilter getClassFilter();\n @Override public MethodMatcher getMethodMatcher();\n}\n", "raw_body_no_cmt": "public class AspectJExpressionPointcut implements Pointcut, ClassFilter, MethodMatcher {\n private static final Set<PointcutPrimitive> SUPPORTED_PRIMITIVES=new HashSet<PointcutPrimitive>();\nstatic {\n SUPPORTED_PRIMITIVES.add(PointcutPrimitive.EXECUTION);\n }\n private final PointcutExpression pointcutExpression;\n public AspectJExpressionPointcut( String expression);\n public boolean matches( Class<?> clazz);\n public boolean matches( Method method, Class<?> targetClass);\n public ClassFilter getClassFilter();\n public MethodMatcher getMethodMatcher();\n}\n"}}]
[{"setExpression": {"retrieved_name": "setName", "raw_body": "public void setName(String name){\n this.name=name;\n}\n"}}]
[{"getPointcut": {"retrieved_name": "getPointcut", "raw_body": "Pointcut getPointcut();\n"}}]
Pay-Group_best-pay-sdk
best-pay-sdk/src/main/java/com/lly835/bestpay/service/impl/wx/WxPayMicroServiceImpl.java
WxPayMicroServiceImpl
pay
class WxPayMicroServiceImpl extends WxPayServiceImpl { /** * 微信付款码支付 * 提交支付请求后微信会同步返回支付结果。 * 当返回结果为“系统错误 {@link WxPayConstants#SYSTEMERROR}”时,商户系统等待5秒后调用【查询订单API {@link WxPayServiceImpl#query(OrderQueryRequest)}】,查询支付实际交易结果; * 当返回结果为“正在支付 {@link WxPayConstants#USERPAYING}”时,商户系统可设置间隔时间(建议10秒)重新查询支付结果,直到支付成功或超时(建议30秒); * * @param request * @return */ @Override public PayResponse pay(PayRequest request) {<FILL_FUNCTION_BODY>} }
WxPayUnifiedorderRequest wxRequest = new WxPayUnifiedorderRequest(); wxRequest.setOutTradeNo(request.getOrderId()); wxRequest.setTotalFee(MoneyUtil.Yuan2Fen(request.getOrderAmount())); wxRequest.setBody(request.getOrderName()); wxRequest.setOpenid(request.getOpenid()); wxRequest.setAuthCode(request.getAuthCode()); wxRequest.setAppid(wxPayConfig.getAppId()); wxRequest.setMchId(wxPayConfig.getMchId()); wxRequest.setNonceStr(RandomUtil.getRandomStr()); wxRequest.setSpbillCreateIp(StringUtils.isEmpty(request.getSpbillCreateIp()) ? "8.8.8.8" : request.getSpbillCreateIp()); wxRequest.setAttach(request.getAttach()); wxRequest.setSign(WxPaySignature.sign(MapUtil.buildMap(wxRequest), wxPayConfig.getMchKey())); //对付款码支付无用的字段 wxRequest.setNotifyUrl(""); wxRequest.setTradeType(""); RequestBody body = RequestBody.create(MediaType.parse("application/xml; charset=utf-8"), XmlUtil.toString(wxRequest)); WxPayApi api = null; if (wxPayConfig.isSandbox()) { api = devRetrofit.create(WxPayApi.class); } else { api = retrofit.create(WxPayApi.class); } Call<WxPaySyncResponse> call = api.micropay(body); Response<WxPaySyncResponse> retrofitResponse = null; try { retrofitResponse = call.execute(); } catch (IOException e) { e.printStackTrace(); } assert retrofitResponse != null; if (!retrofitResponse.isSuccessful()) { throw new RuntimeException("【微信付款码支付】发起支付, 网络异常"); } return buildPayResponse(retrofitResponse.body());
/** * Created by 廖师兄 2017-07-02 13:40 */ @Slf4j public class WxPayServiceImpl extends BestPayServiceImpl { protected WxPayConfig wxPayConfig; protected final Retrofit retrofit=new Retrofit.Builder().baseUrl(WxPayConstants.WXPAY_GATEWAY).addConverterFactory(SimpleXmlConverterFactory.create()).client(new OkHttpClient.Builder().addInterceptor((new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY))).build()).build(); protected final Retrofit devRetrofit=new Retrofit.Builder().baseUrl(WxPayConstants.WXPAY_GATEWAY_SANDBOX).addConverterFactory(SimpleXmlConverterFactory.create()).client(new OkHttpClient.Builder().addInterceptor((new HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY))).build()).build(); @Override public void setWxPayConfig( WxPayConfig wxPayConfig); @Override public PayResponse pay( PayRequest request); @Override public boolean verify( Map map, SignType signType, String sign); @Override public PayResponse syncNotify( HttpServletRequest request); /** * 异步通知 * @param notifyData * @return */ @Override public PayResponse asyncNotify( String notifyData); /** * 微信退款 * @param request * @return */ @Override public RefundResponse refund( RefundRequest request); /** * 查询订单 * @param request * @return */ @Override public OrderQueryResponse query( OrderQueryRequest request); private RefundResponse buildRefundResponse( WxRefundResponse response); private PayResponse buildPayResponse( WxPayAsyncResponse response); /** * 返回给h5的参数 * @param response * @return */ protected PayResponse buildPayResponse( WxPaySyncResponse response); /** * 返回给企业付款到银行卡的参数 * @param response * @return */ private PayBankResponse buildPayBankResponse( WxPaySyncResponse response); /** * @param request * @return */ @Override public String downloadBill( DownloadBillRequest request); /** * 根据微信规则生成扫码二维码的URL * @return */ @Override public String getQrCodeUrl( String productId); @Override public PayBankResponse payBank( PayBankRequest request); }
WxPayRequest wxPayRequest = (WxPayRequest) request; WxPayAsyncRequest wxPayAsyncRequest = new WxPayAsyncRequest(); wxPayAsyncRequest.setAppid(wxPayConfig.getAppId()); wxPayAsyncRequest.setMchId(wxPayConfig.getMchId()); wxPayAsyncRequest.setNonceStr(wxPayConfig.getNonceStr()); wxPayAsyncRequest.setSign(wxPayConfig.getSign(wxPayAsyncRequest)); wxPayAsyncRequest.setBody(wxPayRequest.getBody()); wxPayAsyncRequest.setOutTradeNo(wxPayRequest.getOrderId()); wxPayAsyncRequest.setTotalFee(wxPayRequest.getTotalFee()); wxPayAsyncRequest.setSpbillCreateIp(wxPayRequest.getSpbillCreateIp()); wxPayAsyncRequest.setTradeType(wxPayRequest.getTradeType()); wxPayAsyncRequest.setNotifyUrl(wxPayRequest.getNotifyUrl()); wxPayAsyncRequest.setLimitPay(wxPayRequest.getLimitPay()); wxPayAsyncRequest.setOpenid(wxPayRequest.getOpenid()); wxPayAsyncRequest.setSceneInfo(wxPayRequest.getSceneInfo()); wxPayAsyncRequest.setDeviceInfo(wxPayRequest.getDeviceInfo()); wxPayAsyncRequest.setAttach(wxPayRequest.getAttach()); wxPayAsyncRequest.setFeeType(wxPayRequest.getFeeType()); wxPayAsyncRequest.setTimeStart(wxPayRequest.getTimeStart()); wxPayAsyncRequest.setTimeExpire(wxPayRequest
[ "WxPayRequest", "WxPayAsyncRequest", "PayRequest" ]
[ "getBody", "setDeviceInfo", "setFeeType", "setTimeStart", "getDeviceInfo", "setBody", "getOrderId", "setTotalFee", "getSpbillCreateIp", "setLimitPay", "getTotalFee", "getAttach", "setOpenid", "setSign", "getOpenid", "setNonceStr", "getTimeStart", "setSceneInfo", "getTradeType", "getNotifyUrl", "setSpbillCreateIp", "setAppid", "getSceneInfo", "getNonceStr", "getFeeType", "setTimeExpire", "getLimitPay", "getMchId", "setMchId", "setAttach", "setOutTradeNo", "getAppId", "setTradeType", "setNotifyUrl", "getSign" ]
[ "WxPayUnifiedorderRequest", "WxPayApi", "PayRequest", "IOException", "Call<WxPaySyncResponse>", "assert", "RequestBody" ]
[ "setNonceStr", "setOpenid", "body", "setAppid", "create", "execute", "getMchId", "setBody", "setNotifyUrl", "micropay", "getMchKey", "getSpbillCreateIp", "getRandomStr", "printStackTrace", "setSign", "isEmpty", "setAttach", "setTradeType", "isSuccessful", "getOpenid", "getOrderAmount", "getAppId", "getOrderName", "buildMap", "setMchId", "setSpbillCreateIp", "isSandbox", "sign", "getOrderId", "toString", "setOutTradeNo", "setAuthCode", "parse", "getAuthCode", "Yuan2Fen", "getAttach", "setTotalFee" ]
{ "methods": [ "getBody", "setDeviceInfo", "setFeeType", "setTimeStart", "getDeviceInfo", "setBody", "getOrderId", "setTotalFee", "getSpbillCreateIp", "setLimitPay", "getTotalFee", "getAttach", "setOpenid", "setSign", "getOpenid", "setNonceStr", "getTimeStart", "setSceneInfo", "getTradeType", "getNotifyUrl", "setSpbillCreateIp", "setAppid", "getSceneInfo", "getNonceStr", "getFeeType", "setTimeExpire", "getLimitPay", "getMchId", "setMchId", "setAttach", "setOutTradeNo", "getAppId", "setTradeType", "setNotifyUrl", "getSign" ], "similar_methods": [ "pay" ], "types": [ "WxPayRequest", "WxPayAsyncRequest", "PayRequest" ] }
/** * Created by 廖师兄 2017-07-02 13:42 */ @Data @Builder @NoArgsConstructor @AllArgsConstructor @Accessors(chain=true) @Root(name="xml",strict=false) public class WxPayBankRequest { @Element(name="mch_id") private String mchId; @Element(name="nonce_str") private String nonceStr; @Element(name="sign") private String sign; /** * 商户企业付款单号 */ @Element(name="partner_trade_no") private String partnerTradeNo; /** * 收款方银行卡号 */ @Element(name="enc_bank_no") private String encBankNo; /** * 收款方用户名 */ @Element(name="enc_true_name") private String encTrueName; /** * 收款方开户行 https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=24_4&index=5 */ @Element(name="bank_code") private String bankCode; /** * 付款金额 */ @Element(name="amount") private Integer amount; /** * 付款说明 */ @Element(name="desc") private String desc; } /** * 异步返回参数 Created by 廖师兄 2017-07-02 20:55 */ @Data @Root(name="xml",strict=false) public class WxPayAsyncResponse { @Element(name="return_code") private String returnCode; @Element(name="return_msg",required=false) private String returnMsg; /** * 以下字段在return_code为SUCCESS的时候有返回. */ @Element(name="appid",required=false) private String appid; @Element(name="mch_id",required=false) private String mchId; @Element(name="device_info",required=false) private String deviceInfo; @Element(name="nonce_str",required=false) private String nonceStr; @Element(name="sign",required=false) private String sign; @Element(name="result_code",required=false) private String resultCode; @Element(name="err_code",required=false) private String errCode; @Element(name="err_code_des",required=false) private String errCodeDes; @Element(name="openid",required=false) private String openid; @Element(name="is_subscribe",required=false) private String isSubscribe; @Element(name="trade_type",required=false) private String tradeType; @Element(name="bank_type",required=false) private String bankType; @Element(name="total_fee",required=false) private Integer totalFee; @Element(name="fee_type",required=false) private String feeType; @Element(name="cash_fee",required=false) private String cashFee; @Element(name="cash_fee_type",required=false) private String cashFeeType; @Element(name="coupon_fee",required=false) private String couponFee; @Element(name="coupon_count",required=false) private String couponCount; @Element(name="transaction_id",required=false) private String transactionId; @Element(name="out_trade_no",required=false) private String outTradeNo; @Element(name="attach",required=false) private String attach; @Element(name="time_end",required=false) private String timeEnd; @Element(name="mweb_url",required=false) private String mwebUrl; @Element(name="settlement_total_fee",required=false) private Integer settlementTotalFee; @Element(name="coupon_type",required=false) private String couponType; } /** * 支付时请求参数 */ @Data public class PayRequest { /** * 支付方式. */ private BestPayTypeEnum payTypeEnum; /** * 订单号. */ private String orderId; /** * 订单金额. */ private Double orderAmount; /** * 订单名字. */ private String orderName; /** * 微信openid, 仅微信公众号/小程序支付时需要 */ private String openid; /** * 客户端访问Ip 外部H5支付时必传,需要真实Ip 20191015测试,微信h5支付已不需要真实的ip */ private String spbillCreateIp; /** * 附加内容,发起支付时传入 */ private String attach; /** * 支付后跳转(支付宝PC网站支付) 优先级高于PayConfig.returnUrl */ private String returnUrl; /** * 买家支付宝账号 {@link AliPayTradeCreateRequest.BizContent} */ private String buyerLogonId; /** * 买家的支付宝唯一用户号(2088开头的16位纯数字) {@link AliPayTradeCreateRequest.BizContent} */ private String buyerId; /** * 付款码 */ private String authCode; } public void get(String mchId,String mchKey){ Retrofit retrofit=new Retrofit.Builder().baseUrl(WxPayConstants.WXPAY_GATEWAY).addConverterFactory(SimpleXmlConverterFactory.create()).build(); SandboxParam sandboxParam=new SandboxParam(); sandboxParam.setMchId(mchId); sandboxParam.setNonceStr(RandomUtil.getRandomStr()); sandboxParam.setSign(WxPaySignature.sign(sandboxParam.buildMap(),mchKey)); String xml=XmlUtil.toString(sandboxParam); RequestBody body=RequestBody.create(MediaType.parse("application/xml; charset=utf-8"),xml); Call<WxPaySandboxKeyResponse> call=retrofit.create(WxPayApi.class).getsignkey(body); Response<WxPaySandboxKeyResponse> retrofitResponse=null; try { retrofitResponse=call.execute(); } catch ( IOException e) { e.printStackTrace(); } if (!retrofitResponse.isSuccessful()) { throw new RuntimeException("【微信统一支付】发起支付,网络异常," + retrofitResponse); } Object response=retrofitResponse.body(); log.info("【获取微信沙箱密钥】response={}",JsonUtil.toJson(response)); } public String getDesc(){ return desc; } BestPayTypeEnum(String code,BestPayPlatformEnum platform,String desc){ this.code=code; this.platform=platform; this.desc=desc; } public void setSandbox(boolean sandbox){ this.sandbox=sandbox; } public String getDesc(){ return desc; } public void setSandbox(boolean sandbox){ this.sandbox=sandbox; } public static String getRequestUrl(Map<String,String> parameters,Boolean isSandbox){ StringBuffer urlSb; if (isSandbox) urlSb=new StringBuffer(AliPayConstants.ALIPAY_GATEWAY_OPEN_DEV); else urlSb=new StringBuffer(AliPayConstants.ALIPAY_GATEWAY_OPEN); urlSb.append("/gateway.do"); try { String charset=null != parameters.get("charset") ? parameters.get("charset") : "utf-8"; String sysMustQuery=WebUtil.buildQuery(parameters,charset); urlSb.append("?"); urlSb.append(sysMustQuery); } catch ( IOException e) { e.printStackTrace(); } return urlSb.toString(); } public void setWxPayConfig(WxPayConfig wxPayConfig){ this.wxPayConfig=wxPayConfig; } public static String getRequestUrl(Map<String,String> parameters,Boolean isSandbox){ StringBuffer urlSb; if (isSandbox) urlSb=new StringBuffer(AliPayConstants.ALIPAY_GATEWAY_OPEN_DEV); else urlSb=new StringBuffer(AliPayConstants.ALIPAY_GATEWAY_OPEN); urlSb.append("/gateway.do"); try { String charset=null != parameters.get("charset") ? parameters.get("charset") : "utf-8"; String sysMustQuery=WebUtil.buildQuery(parameters,charset); urlSb.append("?"); urlSb.append(sysMustQuery); } catch ( IOException e) { e.printStackTrace(); } return urlSb.toString(); } public void setWxPayConfig(WxPayConfig wxPayConfig){ this.wxPayConfig=wxPayConfig; } public String getName(){ return name; } /** * 发送get请求 * @param url 路径 * @return */ public static String get(String url){ String responseString=null; try { DefaultHttpClient client=new DefaultHttpClient(); HttpGet request=new HttpGet(url); HttpResponse response=client.execute(request); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { return EntityUtils.toString(response.getEntity()); } else { logger.error("get请求提交失败:" + url); } } catch ( IOException e) { logger.error("get请求提交失败:" + url,e); } return responseString; } public void setSandbox(boolean sandbox){ this.sandbox=sandbox; } /** * 签名 * @param params * @param signKey * @return */ public static String sign(Map<String,String> params,String signKey){ SortedMap<String,String> sortedMap=new TreeMap<>(params); StringBuilder toSign=new StringBuilder(); for ( String key : sortedMap.keySet()) { String value=params.get(key); if (StringUtils.isNotEmpty(value) && !"sign".equals(key) && !"key".equals(key)) { toSign.append(key).append("=").append(value).append("&"); } } toSign.append("key=").append(signKey); return DigestUtils.md5Hex(toSign.toString()).toUpperCase(); } public String getCode(){ return code; } public void setNotifyUrl(String notifyUrl){ this.notifyUrl=notifyUrl; } public void get(String mchId,String mchKey){ Retrofit retrofit=new Retrofit.Builder().baseUrl(WxPayConstants.WXPAY_GATEWAY).addConverterFactory(SimpleXmlConverterFactory.create()).build(); SandboxParam sandboxParam=new SandboxParam(); sandboxParam.setMchId(mchId); sandboxParam.setNonceStr(RandomUtil.getRandomStr()); sandboxParam.setSign(WxPaySignature.sign(sandboxParam.buildMap(),mchKey)); String xml=XmlUtil.toString(sandboxParam); RequestBody body=RequestBody.create(MediaType.parse("application/xml; charset=utf-8"),xml); Call<WxPaySandboxKeyResponse> call=retrofit.create(WxPayApi.class).getsignkey(body); Response<WxPaySandboxKeyResponse> retrofitResponse=null; try { retrofitResponse=call.execute(); } catch ( IOException e) { e.printStackTrace(); } if (!retrofitResponse.isSuccessful()) { throw new RuntimeException("【微信统一支付】发起支付,网络异常," + retrofitResponse); } Object response=retrofitResponse.body(); log.info("【获取微信沙箱密钥】response={}",JsonUtil.toJson(response)); } public void setSandbox(boolean sandbox){ this.sandbox=sandbox; } @FormUrlEncoded @Headers("Content-Type:application/x-www-form-urlencoded; charset=utf-8") @POST("/gateway.do") Call<AliPayOrderCreateResponse> tradeCreate(@FieldMap Map<String,String> map); public String getNotifyUrl(){ return notifyUrl; } public void setNotifyUrl(String notifyUrl){ this.notifyUrl=notifyUrl; } public void setSandbox(boolean sandbox){ this.sandbox=sandbox; } public String getName(){ return name; } public static String getRandomStr(){ StringBuilder sb=new StringBuilder(); for (int i=0; i < 16; i++) { sb.append(RANDOM_STR.charAt(RANDOM.nextInt(RANDOM_STR.length()))); } return sb.toString(); } BestPayTypeEnum(String code,BestPayPlatformEnum platform,String desc){ this.code=code; this.platform=platform; this.desc=desc; } public void setSandbox(boolean sandbox){ this.sandbox=sandbox; } /** * 付款码支付 * @param body * @return */ @POST("pay/micropay") Call<WxPaySyncResponse> micropay(@Body RequestBody body); public void get(String mchId,String mchKey){ Retrofit retrofit=new Retrofit.Builder().baseUrl(WxPayConstants.WXPAY_GATEWAY).addConverterFactory(SimpleXmlConverterFactory.create()).build(); SandboxParam sandboxParam=new SandboxParam(); sandboxParam.setMchId(mchId); sandboxParam.setNonceStr(RandomUtil.getRandomStr()); sandboxParam.setSign(WxPaySignature.sign(sandboxParam.buildMap(),mchKey)); String xml=XmlUtil.toString(sandboxParam); RequestBody body=RequestBody.create(MediaType.parse("application/xml; charset=utf-8"),xml); Call<WxPaySandboxKeyResponse> call=retrofit.create(WxPayApi.class).getsignkey(body); Response<WxPaySandboxKeyResponse> retrofitResponse=null; try { retrofitResponse=call.execute(); } catch ( IOException e) { e.printStackTrace(); } if (!retrofitResponse.isSuccessful()) { throw new RuntimeException("【微信统一支付】发起支付,网络异常," + retrofitResponse); } Object response=retrofitResponse.body(); log.info("【获取微信沙箱密钥】response={}",JsonUtil.toJson(response)); } public void setSandbox(boolean sandbox){ this.sandbox=sandbox; } public void setSandbox(boolean sandbox){ this.sandbox=sandbox; } @FormUrlEncoded @Headers("Content-Type:application/x-www-form-urlencoded; charset=utf-8") @POST("/gateway.do") Call<AliPayOrderCreateResponse> tradeCreate(@FieldMap Map<String,String> map); public String getCode(){ return code; } @FormUrlEncoded @Headers("Content-Type:application/x-www-form-urlencoded; charset=utf-8") @POST("/gateway.do") Call<AliPayOrderCreateResponse> tradeCreate(@FieldMap Map<String,String> map); public void setNotifyUrl(String notifyUrl){ this.notifyUrl=notifyUrl; } public static String getSignContent(Map<String,String> params){ StringBuffer content=new StringBuffer(); List<String> keys=new ArrayList<>(params.keySet()); Collections.sort(keys); int index=0; for (int i=0; i < keys.size(); i++) { String key=keys.get(i); String value=params.get(key); if (StringUtils.isNotBlank(key) && StringUtils.isNotBlank(value)) { content.append((index == 0 ? "" : "&") + key + "="+ value); index++; } } return content.toString(); } @Override public PayResponse pay(PayRequest request){ AliPayTradeCreateRequest aliPayOrderQueryRequest=new AliPayTradeCreateRequest(); aliPayOrderQueryRequest.setMethod(AliPayConstants.ALIPAY_TRADE_APP_PAY); aliPayOrderQueryRequest.setAppId(aliPayConfig.getAppId()); aliPayOrderQueryRequest.setTimestamp(LocalDateTime.now().format(formatter)); aliPayOrderQueryRequest.setNotifyUrl(aliPayConfig.getNotifyUrl()); AliPayTradeCreateRequest.BizContent bizContent=new AliPayTradeCreateRequest.BizContent(); bizContent.setOutTradeNo(request.getOrderId()); bizContent.setTotalAmount(request.getOrderAmount()); bizContent.setSubject(request.getOrderName()); bizContent.setPassbackParams(request.getAttach()); aliPayOrderQueryRequest.setBizContent(JsonUtil.toJsonWithUnderscores(bizContent).replaceAll("\\s*","")); String sign=AliPaySignature.sign(MapUtil.object2MapWithUnderline(aliPayOrderQueryRequest),aliPayConfig.getPrivateKey()); aliPayOrderQueryRequest.setSign(URLEncoder.encode(sign)); Map<String,String> stringStringMap=MapUtil.object2MapWithUnderline(aliPayOrderQueryRequest); String body=MapUtil.toUrl(stringStringMap); PayResponse payResponse=new PayResponse(); payResponse.setBody(body); return payResponse; }
public class WxPayBankRequest { private String mchId; private String nonceStr; private String sign; private String partnerTradeNo; private String encBankNo; private String encTrueName; private String bankCode; private Integer amount; private String desc; } public class WxPayAsyncResponse { private String returnCode; private String returnMsg; private String appid; private String mchId; private String deviceInfo; private String nonceStr; private String sign; private String resultCode; private String errCode; private String errCodeDes; private String openid; private String isSubscribe; private String tradeType; private String bankType; private Integer totalFee; private String feeType; private String cashFee; private String cashFeeType; private String couponFee; private String couponCount; private String transactionId; private String outTradeNo; private String attach; private String timeEnd; private String mwebUrl; private Integer settlementTotalFee; private String couponType; } public class PayRequest { private BestPayTypeEnum payTypeEnum; private String orderId; private Double orderAmount; private String orderName; private String openid; private String spbillCreateIp; private String attach; private String returnUrl; private String buyerLogonId; private String buyerId; private String authCode; } public void get(String mchId,String mchKey){ Retrofit retrofit=new Retrofit.Builder().baseUrl(WxPayConstants.WXPAY_GATEWAY).addConverterFactory(SimpleXmlConverterFactory.create()).build(); SandboxParam sandboxParam=new SandboxParam(); sandboxParam.setMchId(mchId); sandboxParam.setNonceStr(RandomUtil.getRandomStr()); sandboxParam.setSign(WxPaySignature.sign(sandboxParam.buildMap(),mchKey)); String xml=XmlUtil.toString(sandboxParam); RequestBody body=RequestBody.create(MediaType.parse("application/xml; charset=utf-8"),xml); Call<WxPaySandboxKeyResponse> call=retrofit.create(WxPayApi.class).getsignkey(body); Response<WxPaySandboxKeyResponse> retrofitResponse=null; try { retrofitResponse=call.execute(); } catch ( IOException e) { e.printStackTrace(); } if (!retrofitResponse.isSuccessful()) { throw new RuntimeException("【微信统一支付】发起支付,网络异常," + retrofitResponse); } Object response=retrofitResponse.body(); log.info("【获取微信沙箱密钥】response={}",JsonUtil.toJson(response)); } public String getDesc(){ return desc; } BestPayTypeEnum(String code,BestPayPlatformEnum platform,String desc){ this.code=code; this.platform=platform; this.desc=desc; } public void setSandbox(boolean sandbox){ this.sandbox=sandbox; } public String getDesc(){ return desc; } public void setSandbox(boolean sandbox){ this.sandbox=sandbox; } public static String getRequestUrl(Map<String,String> parameters,Boolean isSandbox){ StringBuffer urlSb; if (isSandbox) urlSb=new StringBuffer(AliPayConstants.ALIPAY_GATEWAY_OPEN_DEV); else urlSb=new StringBuffer(AliPayConstants.ALIPAY_GATEWAY_OPEN); urlSb.append("/gateway.do"); try { String charset=null != parameters.get("charset") ? parameters.get("charset") : "utf-8"; String sysMustQuery=WebUtil.buildQuery(parameters,charset); urlSb.append("?"); urlSb.append(sysMustQuery); } catch ( IOException e) { e.printStackTrace(); } return urlSb.toString(); } public void setWxPayConfig(WxPayConfig wxPayConfig){ this.wxPayConfig=wxPayConfig; } public static String getRequestUrl(Map<String,String> parameters,Boolean isSandbox){ StringBuffer urlSb; if (isSandbox) urlSb=new StringBuffer(AliPayConstants.ALIPAY_GATEWAY_OPEN_DEV); else urlSb=new StringBuffer(AliPayConstants.ALIPAY_GATEWAY_OPEN); urlSb.append("/gateway.do"); try { String charset=null != parameters.get("charset") ? parameters.get("charset") : "utf-8"; String sysMustQuery=WebUtil.buildQuery(parameters,charset); urlSb.append("?"); urlSb.append(sysMustQuery); } catch ( IOException e) { e.printStackTrace(); } return urlSb.toString(); } public void setWxPayConfig(WxPayConfig wxPayConfig){ this.wxPayConfig=wxPayConfig; } public String getName(){ return name; } /** * 发送get请求 * @param url 路径 * @return */ public static String get(String url){ String responseString=null; try { DefaultHttpClient client=new DefaultHttpClient(); HttpGet request=new HttpGet(url); HttpResponse response=client.execute(request); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { return EntityUtils.toString(response.getEntity()); } else { logger.error("get请求提交失败:" + url); } } catch ( IOException e) { logger.error("get请求提交失败:" + url,e); } return responseString; } public void setSandbox(boolean sandbox){ this.sandbox=sandbox; } /** * 签名 * @param params * @param signKey * @return */ public static String sign(Map<String,String> params,String signKey){ SortedMap<String,String> sortedMap=new TreeMap<>(params); StringBuilder toSign=new StringBuilder(); for ( String key : sortedMap.keySet()) { String value=params.get(key); if (StringUtils.isNotEmpty(value) && !"sign".equals(key) && !"key".equals(key)) { toSign.append(key).append("=").append(value).append("&"); } } toSign.append("key=").append(signKey); return DigestUtils.md5Hex(toSign.toString()).toUpperCase(); } public String getCode(){ return code; } public void setNotifyUrl(String notifyUrl){ this.notifyUrl=notifyUrl; } public void get(String mchId,String mchKey){ Retrofit retrofit=new Retrofit.Builder().baseUrl(WxPayConstants.WXPAY_GATEWAY).addConverterFactory(SimpleXmlConverterFactory.create()).build(); SandboxParam sandboxParam=new SandboxParam(); sandboxParam.setMchId(mchId); sandboxParam.setNonceStr(RandomUtil.getRandomStr()); sandboxParam.setSign(WxPaySignature.sign(sandboxParam.buildMap(),mchKey)); String xml=XmlUtil.toString(sandboxParam); RequestBody body=RequestBody.create(MediaType.parse("application/xml; charset=utf-8"),xml); Call<WxPaySandboxKeyResponse> call=retrofit.create(WxPayApi.class).getsignkey(body); Response<WxPaySandboxKeyResponse> retrofitResponse=null; try { retrofitResponse=call.execute(); } catch ( IOException e) { e.printStackTrace(); } if (!retrofitResponse.isSuccessful()) { throw new RuntimeException("【微信统一支付】发起支付,网络异常," + retrofitResponse); } Object response=retrofitResponse.body(); log.info("【获取微信沙箱密钥】response={}",JsonUtil.toJson(response)); } public void setSandbox(boolean sandbox){ this.sandbox=sandbox; } @FormUrlEncoded @Headers("Content-Type:application/x-www-form-urlencoded; charset=utf-8") @POST("/gateway.do") Call<AliPayOrderCreateResponse> tradeCreate(@FieldMap Map<String,String> map); public String getNotifyUrl(){ return notifyUrl; } public void setNotifyUrl(String notifyUrl){ this.notifyUrl=notifyUrl; } public void setSandbox(boolean sandbox){ this.sandbox=sandbox; } public String getName(){ return name; } public static String getRandomStr(){ StringBuilder sb=new StringBuilder(); for (int i=0; i < 16; i++) { sb.append(RANDOM_STR.charAt(RANDOM.nextInt(RANDOM_STR.length()))); } return sb.toString(); } BestPayTypeEnum(String code,BestPayPlatformEnum platform,String desc){ this.code=code; this.platform=platform; this.desc=desc; } public void setSandbox(boolean sandbox){ this.sandbox=sandbox; } /** * 付款码支付 * @param body * @return */ @POST("pay/micropay") Call<WxPaySyncResponse> micropay(@Body RequestBody body); public void get(String mchId,String mchKey){ Retrofit retrofit=new Retrofit.Builder().baseUrl(WxPayConstants.WXPAY_GATEWAY).addConverterFactory(SimpleXmlConverterFactory.create()).build(); SandboxParam sandboxParam=new SandboxParam(); sandboxParam.setMchId(mchId); sandboxParam.setNonceStr(RandomUtil.getRandomStr()); sandboxParam.setSign(WxPaySignature.sign(sandboxParam.buildMap(),mchKey)); String xml=XmlUtil.toString(sandboxParam); RequestBody body=RequestBody.create(MediaType.parse("application/xml; charset=utf-8"),xml); Call<WxPaySandboxKeyResponse> call=retrofit.create(WxPayApi.class).getsignkey(body); Response<WxPaySandboxKeyResponse> retrofitResponse=null; try { retrofitResponse=call.execute(); } catch ( IOException e) { e.printStackTrace(); } if (!retrofitResponse.isSuccessful()) { throw new RuntimeException("【微信统一支付】发起支付,网络异常," + retrofitResponse); } Object response=retrofitResponse.body(); log.info("【获取微信沙箱密钥】response={}",JsonUtil.toJson(response)); } public void setSandbox(boolean sandbox){ this.sandbox=sandbox; } public void setSandbox(boolean sandbox){ this.sandbox=sandbox; } @FormUrlEncoded @Headers("Content-Type:application/x-www-form-urlencoded; charset=utf-8") @POST("/gateway.do") Call<AliPayOrderCreateResponse> tradeCreate(@FieldMap Map<String,String> map); public String getCode(){ return code; } @FormUrlEncoded @Headers("Content-Type:application/x-www-form-urlencoded; charset=utf-8") @POST("/gateway.do") Call<AliPayOrderCreateResponse> tradeCreate(@FieldMap Map<String,String> map); public void setNotifyUrl(String notifyUrl){ this.notifyUrl=notifyUrl; } public static String getSignContent(Map<String,String> params){ StringBuffer content=new StringBuffer(); List<String> keys=new ArrayList<>(params.keySet()); Collections.sort(keys); int index=0; for (int i=0; i < keys.size(); i++) { String key=keys.get(i); String value=params.get(key); if (StringUtils.isNotBlank(key) && StringUtils.isNotBlank(value)) { content.append((index == 0 ? "" : "&") + key + "="+ value); index++; } } return content.toString(); } @Override public PayResponse pay(PayRequest request){ AliPayTradeCreateRequest aliPayOrderQueryRequest=new AliPayTradeCreateRequest(); aliPayOrderQueryRequest.setMethod(AliPayConstants.ALIPAY_TRADE_APP_PAY); aliPayOrderQueryRequest.setAppId(aliPayConfig.getAppId()); aliPayOrderQueryRequest.setTimestamp(LocalDateTime.now().format(formatter)); aliPayOrderQueryRequest.setNotifyUrl(aliPayConfig.getNotifyUrl()); AliPayTradeCreateRequest.BizContent bizContent=new AliPayTradeCreateRequest.BizContent(); bizContent.setOutTradeNo(request.getOrderId()); bizContent.setTotalAmount(request.getOrderAmount()); bizContent.setSubject(request.getOrderName()); bizContent.setPassbackParams(request.getAttach()); aliPayOrderQueryRequest.setBizContent(JsonUtil.toJsonWithUnderscores(bizContent).replaceAll("\\s*","")); String sign=AliPaySignature.sign(MapUtil.object2MapWithUnderline(aliPayOrderQueryRequest),aliPayConfig.getPrivateKey()); aliPayOrderQueryRequest.setSign(URLEncoder.encode(sign)); Map<String,String> stringStringMap=MapUtil.object2MapWithUnderline(aliPayOrderQueryRequest); String body=MapUtil.toUrl(stringStringMap); PayResponse payResponse=new PayResponse(); payResponse.setBody(body); return payResponse; }
{"types": [{"WxPayRequest": "WxPayBankRequest"}, {"WxPayAsyncRequest": "WxPayAsyncResponse"}, {"PayRequest": "PayRequest"}], "methods": [{"getBody": "get"}, {"setDeviceInfo": "getDesc"}, {"setFeeType": "BestPayTypeEnum"}, {"setTimeStart": "setSandbox"}, {"getDeviceInfo": "getDesc"}, {"setBody": "setSandbox"}, {"getOrderId": "getRequestUrl"}, {"setTotalFee": "setWxPayConfig"}, {"getSpbillCreateIp": "getRequestUrl"}, {"setLimitPay": "setWxPayConfig"}, {"getTotalFee": "getName"}, {"getAttach": "get"}, {"setOpenid": "setSandbox"}, {"setSign": "sign"}, {"getOpenid": "getCode"}, {"setNonceStr": "setNotifyUrl"}, {"getTimeStart": "get"}, {"setSceneInfo": "setSandbox"}, {"getTradeType": "tradeCreate"}, {"getNotifyUrl": "getNotifyUrl"}, {"setSpbillCreateIp": "setNotifyUrl"}, {"setAppid": "setSandbox"}, {"getSceneInfo": "getName"}, {"getNonceStr": "getRandomStr"}, {"getFeeType": "BestPayTypeEnum"}, {"setTimeExpire": "setSandbox"}, {"getLimitPay": "micropay"}, {"getMchId": "get"}, {"setMchId": "setSandbox"}, {"setAttach": "setSandbox"}, {"setOutTradeNo": "tradeCreate"}, {"getAppId": "getCode"}, {"setTradeType": "tradeCreate"}, {"setNotifyUrl": "setNotifyUrl"}, {"getSign": "getSignContent"}], "similar_methods": [{"pay": "pay"}]}
[{"WxPayRequest": {"retrieved_name": "WxPayBankRequest", "raw_body": "/** \n * Created by \u5ed6\u5e08\u5144 2017-07-02 13:42\n */\n@Data @Builder @NoArgsConstructor @AllArgsConstructor @Accessors(chain=true) @Root(name=\"xml\",strict=false) public class WxPayBankRequest {\n @Element(name=\"mch_id\") private String mchId;\n @Element(name=\"nonce_str\") private String nonceStr;\n @Element(name=\"sign\") private String sign;\n /** \n * \u5546\u6237\u4f01\u4e1a\u4ed8\u6b3e\u5355\u53f7\n */\n @Element(name=\"partner_trade_no\") private String partnerTradeNo;\n /** \n * \u6536\u6b3e\u65b9\u94f6\u884c\u5361\u53f7\n */\n @Element(name=\"enc_bank_no\") private String encBankNo;\n /** \n * \u6536\u6b3e\u65b9\u7528\u6237\u540d\n */\n @Element(name=\"enc_true_name\") private String encTrueName;\n /** \n * \u6536\u6b3e\u65b9\u5f00\u6237\u884c https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=24_4&index=5\n */\n @Element(name=\"bank_code\") private String bankCode;\n /** \n * \u4ed8\u6b3e\u91d1\u989d\n */\n @Element(name=\"amount\") private Integer amount;\n /** \n * \u4ed8\u6b3e\u8bf4\u660e\n */\n @Element(name=\"desc\") private String desc;\n}\n", "raw_body_no_cmt": "public class WxPayBankRequest {\n private String mchId;\n private String nonceStr;\n private String sign;\n private String partnerTradeNo;\n private String encBankNo;\n private String encTrueName;\n private String bankCode;\n private Integer amount;\n private String desc;\n}\n"}}, {"WxPayAsyncRequest": {"retrieved_name": "WxPayAsyncResponse", "raw_body": "/** \n * \u5f02\u6b65\u8fd4\u56de\u53c2\u6570 Created by \u5ed6\u5e08\u5144 2017-07-02 20:55\n */\n@Data @Root(name=\"xml\",strict=false) public class WxPayAsyncResponse {\n @Element(name=\"return_code\") private String returnCode;\n @Element(name=\"return_msg\",required=false) private String returnMsg;\n /** \n * \u4ee5\u4e0b\u5b57\u6bb5\u5728return_code\u4e3aSUCCESS\u7684\u65f6\u5019\u6709\u8fd4\u56de. \n */\n @Element(name=\"appid\",required=false) private String appid;\n @Element(name=\"mch_id\",required=false) private String mchId;\n @Element(name=\"device_info\",required=false) private String deviceInfo;\n @Element(name=\"nonce_str\",required=false) private String nonceStr;\n @Element(name=\"sign\",required=false) private String sign;\n @Element(name=\"result_code\",required=false) private String resultCode;\n @Element(name=\"err_code\",required=false) private String errCode;\n @Element(name=\"err_code_des\",required=false) private String errCodeDes;\n @Element(name=\"openid\",required=false) private String openid;\n @Element(name=\"is_subscribe\",required=false) private String isSubscribe;\n @Element(name=\"trade_type\",required=false) private String tradeType;\n @Element(name=\"bank_type\",required=false) private String bankType;\n @Element(name=\"total_fee\",required=false) private Integer totalFee;\n @Element(name=\"fee_type\",required=false) private String feeType;\n @Element(name=\"cash_fee\",required=false) private String cashFee;\n @Element(name=\"cash_fee_type\",required=false) private String cashFeeType;\n @Element(name=\"coupon_fee\",required=false) private String couponFee;\n @Element(name=\"coupon_count\",required=false) private String couponCount;\n @Element(name=\"transaction_id\",required=false) private String transactionId;\n @Element(name=\"out_trade_no\",required=false) private String outTradeNo;\n @Element(name=\"attach\",required=false) private String attach;\n @Element(name=\"time_end\",required=false) private String timeEnd;\n @Element(name=\"mweb_url\",required=false) private String mwebUrl;\n @Element(name=\"settlement_total_fee\",required=false) private Integer settlementTotalFee;\n @Element(name=\"coupon_type\",required=false) private String couponType;\n}\n", "raw_body_no_cmt": "public class WxPayAsyncResponse {\n private String returnCode;\n private String returnMsg;\n private String appid;\n private String mchId;\n private String deviceInfo;\n private String nonceStr;\n private String sign;\n private String resultCode;\n private String errCode;\n private String errCodeDes;\n private String openid;\n private String isSubscribe;\n private String tradeType;\n private String bankType;\n private Integer totalFee;\n private String feeType;\n private String cashFee;\n private String cashFeeType;\n private String couponFee;\n private String couponCount;\n private String transactionId;\n private String outTradeNo;\n private String attach;\n private String timeEnd;\n private String mwebUrl;\n private Integer settlementTotalFee;\n private String couponType;\n}\n"}}, {"PayRequest": {"retrieved_name": "PayRequest", "raw_body": "/** \n * \u652f\u4ed8\u65f6\u8bf7\u6c42\u53c2\u6570\n */\n@Data public class PayRequest {\n /** \n * \u652f\u4ed8\u65b9\u5f0f.\n */\n private BestPayTypeEnum payTypeEnum;\n /** \n * \u8ba2\u5355\u53f7.\n */\n private String orderId;\n /** \n * \u8ba2\u5355\u91d1\u989d.\n */\n private Double orderAmount;\n /** \n * \u8ba2\u5355\u540d\u5b57.\n */\n private String orderName;\n /** \n * \u5fae\u4fe1openid, \u4ec5\u5fae\u4fe1\u516c\u4f17\u53f7/\u5c0f\u7a0b\u5e8f\u652f\u4ed8\u65f6\u9700\u8981\n */\n private String openid;\n /** \n * \u5ba2\u6237\u7aef\u8bbf\u95eeIp \u5916\u90e8H5\u652f\u4ed8\u65f6\u5fc5\u4f20\uff0c\u9700\u8981\u771f\u5b9eIp 20191015\u6d4b\u8bd5\uff0c\u5fae\u4fe1h5\u652f\u4ed8\u5df2\u4e0d\u9700\u8981\u771f\u5b9e\u7684ip\n */\n private String spbillCreateIp;\n /** \n * \u9644\u52a0\u5185\u5bb9\uff0c\u53d1\u8d77\u652f\u4ed8\u65f6\u4f20\u5165\n */\n private String attach;\n /** \n * \u652f\u4ed8\u540e\u8df3\u8f6c\uff08\u652f\u4ed8\u5b9dPC\u7f51\u7ad9\u652f\u4ed8\uff09 \u4f18\u5148\u7ea7\u9ad8\u4e8ePayConfig.returnUrl\n */\n private String returnUrl;\n /** \n * \u4e70\u5bb6\u652f\u4ed8\u5b9d\u8d26\u53f7 {@link AliPayTradeCreateRequest.BizContent}\n */\n private String buyerLogonId;\n /** \n * \u4e70\u5bb6\u7684\u652f\u4ed8\u5b9d\u552f\u4e00\u7528\u6237\u53f7\uff082088\u5f00\u5934\u768416\u4f4d\u7eaf\u6570\u5b57\uff09 {@link AliPayTradeCreateRequest.BizContent}\n */\n private String buyerId;\n /** \n * \u4ed8\u6b3e\u7801\n */\n private String authCode;\n}\n", "raw_body_no_cmt": "public class PayRequest {\n private BestPayTypeEnum payTypeEnum;\n private String orderId;\n private Double orderAmount;\n private String orderName;\n private String openid;\n private String spbillCreateIp;\n private String attach;\n private String returnUrl;\n private String buyerLogonId;\n private String buyerId;\n private String authCode;\n}\n"}}]
[{"getBody": {"retrieved_name": "get", "raw_body": "public void get(String mchId,String mchKey){\n Retrofit retrofit=new Retrofit.Builder().baseUrl(WxPayConstants.WXPAY_GATEWAY).addConverterFactory(SimpleXmlConverterFactory.create()).build();\n SandboxParam sandboxParam=new SandboxParam();\n sandboxParam.setMchId(mchId);\n sandboxParam.setNonceStr(RandomUtil.getRandomStr());\n sandboxParam.setSign(WxPaySignature.sign(sandboxParam.buildMap(),mchKey));\n String xml=XmlUtil.toString(sandboxParam);\n RequestBody body=RequestBody.create(MediaType.parse(\"application/xml; charset=utf-8\"),xml);\n Call<WxPaySandboxKeyResponse> call=retrofit.create(WxPayApi.class).getsignkey(body);\n Response<WxPaySandboxKeyResponse> retrofitResponse=null;\n try {\n retrofitResponse=call.execute();\n }\n catch ( IOException e) {\n e.printStackTrace();\n }\n if (!retrofitResponse.isSuccessful()) {\n throw new RuntimeException(\"\u3010\u5fae\u4fe1\u7edf\u4e00\u652f\u4ed8\u3011\u53d1\u8d77\u652f\u4ed8\uff0c\u7f51\u7edc\u5f02\u5e38\uff0c\" + retrofitResponse);\n }\n Object response=retrofitResponse.body();\n log.info(\"\u3010\u83b7\u53d6\u5fae\u4fe1\u6c99\u7bb1\u5bc6\u94a5\u3011response={}\",JsonUtil.toJson(response));\n}\n"}}, {"setDeviceInfo": {"retrieved_name": "getDesc", "raw_body": "public String getDesc(){\n return desc;\n}\n"}}, {"setFeeType": {"retrieved_name": "BestPayTypeEnum", "raw_body": "BestPayTypeEnum(String code,BestPayPlatformEnum platform,String desc){\n this.code=code;\n this.platform=platform;\n this.desc=desc;\n}\n"}}, {"setTimeStart": {"retrieved_name": "setSandbox", "raw_body": "public void setSandbox(boolean sandbox){\n this.sandbox=sandbox;\n}\n"}}, {"getDeviceInfo": {"retrieved_name": "getDesc", "raw_body": "public String getDesc(){\n return desc;\n}\n"}}, {"setBody": {"retrieved_name": "setSandbox", "raw_body": "public void setSandbox(boolean sandbox){\n this.sandbox=sandbox;\n}\n"}}, {"getOrderId": {"retrieved_name": "getRequestUrl", "raw_body": "public static String getRequestUrl(Map<String,String> parameters,Boolean isSandbox){\n StringBuffer urlSb;\n if (isSandbox) urlSb=new StringBuffer(AliPayConstants.ALIPAY_GATEWAY_OPEN_DEV);\n else urlSb=new StringBuffer(AliPayConstants.ALIPAY_GATEWAY_OPEN);\n urlSb.append(\"/gateway.do\");\n try {\n String charset=null != parameters.get(\"charset\") ? parameters.get(\"charset\") : \"utf-8\";\n String sysMustQuery=WebUtil.buildQuery(parameters,charset);\n urlSb.append(\"?\");\n urlSb.append(sysMustQuery);\n }\n catch ( IOException e) {\n e.printStackTrace();\n }\n return urlSb.toString();\n}\n"}}, {"setTotalFee": {"retrieved_name": "setWxPayConfig", "raw_body": "public void setWxPayConfig(WxPayConfig wxPayConfig){\n this.wxPayConfig=wxPayConfig;\n}\n"}}, {"getSpbillCreateIp": {"retrieved_name": "getRequestUrl", "raw_body": "public static String getRequestUrl(Map<String,String> parameters,Boolean isSandbox){\n StringBuffer urlSb;\n if (isSandbox) urlSb=new StringBuffer(AliPayConstants.ALIPAY_GATEWAY_OPEN_DEV);\n else urlSb=new StringBuffer(AliPayConstants.ALIPAY_GATEWAY_OPEN);\n urlSb.append(\"/gateway.do\");\n try {\n String charset=null != parameters.get(\"charset\") ? parameters.get(\"charset\") : \"utf-8\";\n String sysMustQuery=WebUtil.buildQuery(parameters,charset);\n urlSb.append(\"?\");\n urlSb.append(sysMustQuery);\n }\n catch ( IOException e) {\n e.printStackTrace();\n }\n return urlSb.toString();\n}\n"}}, {"setLimitPay": {"retrieved_name": "setWxPayConfig", "raw_body": "public void setWxPayConfig(WxPayConfig wxPayConfig){\n this.wxPayConfig=wxPayConfig;\n}\n"}}, {"getTotalFee": {"retrieved_name": "getName", "raw_body": "public String getName(){\n return name;\n}\n"}}, {"getAttach": {"retrieved_name": "get", "raw_body": "/** \n * \u53d1\u9001get\u8bf7\u6c42\n * @param url \u8def\u5f84\n * @return\n */\npublic static String get(String url){\n String responseString=null;\n try {\n DefaultHttpClient client=new DefaultHttpClient();\n HttpGet request=new HttpGet(url);\n HttpResponse response=client.execute(request);\n if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {\n return EntityUtils.toString(response.getEntity());\n }\n else {\n logger.error(\"get\u8bf7\u6c42\u63d0\u4ea4\u5931\u8d25:\" + url);\n }\n }\n catch ( IOException e) {\n logger.error(\"get\u8bf7\u6c42\u63d0\u4ea4\u5931\u8d25:\" + url,e);\n }\n return responseString;\n}\n"}}, {"setOpenid": {"retrieved_name": "setSandbox", "raw_body": "public void setSandbox(boolean sandbox){\n this.sandbox=sandbox;\n}\n"}}, {"setSign": {"retrieved_name": "sign", "raw_body": "/** \n * \u7b7e\u540d\n * @param params\n * @param signKey\n * @return\n */\npublic static String sign(Map<String,String> params,String signKey){\n SortedMap<String,String> sortedMap=new TreeMap<>(params);\n StringBuilder toSign=new StringBuilder();\n for ( String key : sortedMap.keySet()) {\n String value=params.get(key);\n if (StringUtils.isNotEmpty(value) && !\"sign\".equals(key) && !\"key\".equals(key)) {\n toSign.append(key).append(\"=\").append(value).append(\"&\");\n }\n }\n toSign.append(\"key=\").append(signKey);\n return DigestUtils.md5Hex(toSign.toString()).toUpperCase();\n}\n"}}, {"getOpenid": {"retrieved_name": "getCode", "raw_body": "public String getCode(){\n return code;\n}\n"}}, {"setNonceStr": {"retrieved_name": "setNotifyUrl", "raw_body": "public void setNotifyUrl(String notifyUrl){\n this.notifyUrl=notifyUrl;\n}\n"}}, {"getTimeStart": {"retrieved_name": "get", "raw_body": "public void get(String mchId,String mchKey){\n Retrofit retrofit=new Retrofit.Builder().baseUrl(WxPayConstants.WXPAY_GATEWAY).addConverterFactory(SimpleXmlConverterFactory.create()).build();\n SandboxParam sandboxParam=new SandboxParam();\n sandboxParam.setMchId(mchId);\n sandboxParam.setNonceStr(RandomUtil.getRandomStr());\n sandboxParam.setSign(WxPaySignature.sign(sandboxParam.buildMap(),mchKey));\n String xml=XmlUtil.toString(sandboxParam);\n RequestBody body=RequestBody.create(MediaType.parse(\"application/xml; charset=utf-8\"),xml);\n Call<WxPaySandboxKeyResponse> call=retrofit.create(WxPayApi.class).getsignkey(body);\n Response<WxPaySandboxKeyResponse> retrofitResponse=null;\n try {\n retrofitResponse=call.execute();\n }\n catch ( IOException e) {\n e.printStackTrace();\n }\n if (!retrofitResponse.isSuccessful()) {\n throw new RuntimeException(\"\u3010\u5fae\u4fe1\u7edf\u4e00\u652f\u4ed8\u3011\u53d1\u8d77\u652f\u4ed8\uff0c\u7f51\u7edc\u5f02\u5e38\uff0c\" + retrofitResponse);\n }\n Object response=retrofitResponse.body();\n log.info(\"\u3010\u83b7\u53d6\u5fae\u4fe1\u6c99\u7bb1\u5bc6\u94a5\u3011response={}\",JsonUtil.toJson(response));\n}\n"}}, {"setSceneInfo": {"retrieved_name": "setSandbox", "raw_body": "public void setSandbox(boolean sandbox){\n this.sandbox=sandbox;\n}\n"}}, {"getTradeType": {"retrieved_name": "tradeCreate", "raw_body": "@FormUrlEncoded @Headers(\"Content-Type:application/x-www-form-urlencoded; charset=utf-8\") @POST(\"/gateway.do\") Call<AliPayOrderCreateResponse> tradeCreate(@FieldMap Map<String,String> map);\n"}}, {"getNotifyUrl": {"retrieved_name": "getNotifyUrl", "raw_body": "public String getNotifyUrl(){\n return notifyUrl;\n}\n"}}, {"setSpbillCreateIp": {"retrieved_name": "setNotifyUrl", "raw_body": "public void setNotifyUrl(String notifyUrl){\n this.notifyUrl=notifyUrl;\n}\n"}}, {"setAppid": {"retrieved_name": "setSandbox", "raw_body": "public void setSandbox(boolean sandbox){\n this.sandbox=sandbox;\n}\n"}}, {"getSceneInfo": {"retrieved_name": "getName", "raw_body": "public String getName(){\n return name;\n}\n"}}, {"getNonceStr": {"retrieved_name": "getRandomStr", "raw_body": "public static String getRandomStr(){\n StringBuilder sb=new StringBuilder();\n for (int i=0; i < 16; i++) {\n sb.append(RANDOM_STR.charAt(RANDOM.nextInt(RANDOM_STR.length())));\n }\n return sb.toString();\n}\n"}}, {"getFeeType": {"retrieved_name": "BestPayTypeEnum", "raw_body": "BestPayTypeEnum(String code,BestPayPlatformEnum platform,String desc){\n this.code=code;\n this.platform=platform;\n this.desc=desc;\n}\n"}}, {"setTimeExpire": {"retrieved_name": "setSandbox", "raw_body": "public void setSandbox(boolean sandbox){\n this.sandbox=sandbox;\n}\n"}}, {"getLimitPay": {"retrieved_name": "micropay", "raw_body": "/** \n * \u4ed8\u6b3e\u7801\u652f\u4ed8\n * @param body\n * @return\n */\n@POST(\"pay/micropay\") Call<WxPaySyncResponse> micropay(@Body RequestBody body);\n"}}, {"getMchId": {"retrieved_name": "get", "raw_body": "public void get(String mchId,String mchKey){\n Retrofit retrofit=new Retrofit.Builder().baseUrl(WxPayConstants.WXPAY_GATEWAY).addConverterFactory(SimpleXmlConverterFactory.create()).build();\n SandboxParam sandboxParam=new SandboxParam();\n sandboxParam.setMchId(mchId);\n sandboxParam.setNonceStr(RandomUtil.getRandomStr());\n sandboxParam.setSign(WxPaySignature.sign(sandboxParam.buildMap(),mchKey));\n String xml=XmlUtil.toString(sandboxParam);\n RequestBody body=RequestBody.create(MediaType.parse(\"application/xml; charset=utf-8\"),xml);\n Call<WxPaySandboxKeyResponse> call=retrofit.create(WxPayApi.class).getsignkey(body);\n Response<WxPaySandboxKeyResponse> retrofitResponse=null;\n try {\n retrofitResponse=call.execute();\n }\n catch ( IOException e) {\n e.printStackTrace();\n }\n if (!retrofitResponse.isSuccessful()) {\n throw new RuntimeException(\"\u3010\u5fae\u4fe1\u7edf\u4e00\u652f\u4ed8\u3011\u53d1\u8d77\u652f\u4ed8\uff0c\u7f51\u7edc\u5f02\u5e38\uff0c\" + retrofitResponse);\n }\n Object response=retrofitResponse.body();\n log.info(\"\u3010\u83b7\u53d6\u5fae\u4fe1\u6c99\u7bb1\u5bc6\u94a5\u3011response={}\",JsonUtil.toJson(response));\n}\n"}}, {"setMchId": {"retrieved_name": "setSandbox", "raw_body": "public void setSandbox(boolean sandbox){\n this.sandbox=sandbox;\n}\n"}}, {"setAttach": {"retrieved_name": "setSandbox", "raw_body": "public void setSandbox(boolean sandbox){\n this.sandbox=sandbox;\n}\n"}}, {"setOutTradeNo": {"retrieved_name": "tradeCreate", "raw_body": "@FormUrlEncoded @Headers(\"Content-Type:application/x-www-form-urlencoded; charset=utf-8\") @POST(\"/gateway.do\") Call<AliPayOrderCreateResponse> tradeCreate(@FieldMap Map<String,String> map);\n"}}, {"getAppId": {"retrieved_name": "getCode", "raw_body": "public String getCode(){\n return code;\n}\n"}}, {"setTradeType": {"retrieved_name": "tradeCreate", "raw_body": "@FormUrlEncoded @Headers(\"Content-Type:application/x-www-form-urlencoded; charset=utf-8\") @POST(\"/gateway.do\") Call<AliPayOrderCreateResponse> tradeCreate(@FieldMap Map<String,String> map);\n"}}, {"setNotifyUrl": {"retrieved_name": "setNotifyUrl", "raw_body": "public void setNotifyUrl(String notifyUrl){\n this.notifyUrl=notifyUrl;\n}\n"}}, {"getSign": {"retrieved_name": "getSignContent", "raw_body": "public static String getSignContent(Map<String,String> params){\n StringBuffer content=new StringBuffer();\n List<String> keys=new ArrayList<>(params.keySet());\n Collections.sort(keys);\n int index=0;\n for (int i=0; i < keys.size(); i++) {\n String key=keys.get(i);\n String value=params.get(key);\n if (StringUtils.isNotBlank(key) && StringUtils.isNotBlank(value)) {\n content.append((index == 0 ? \"\" : \"&\") + key + \"=\"+ value);\n index++;\n }\n }\n return content.toString();\n}\n"}}]
[{"pay": {"retrieved_name": "pay", "raw_body": "@Override public PayResponse pay(PayRequest request){\n AliPayTradeCreateRequest aliPayOrderQueryRequest=new AliPayTradeCreateRequest();\n aliPayOrderQueryRequest.setMethod(AliPayConstants.ALIPAY_TRADE_APP_PAY);\n aliPayOrderQueryRequest.setAppId(aliPayConfig.getAppId());\n aliPayOrderQueryRequest.setTimestamp(LocalDateTime.now().format(formatter));\n aliPayOrderQueryRequest.setNotifyUrl(aliPayConfig.getNotifyUrl());\n AliPayTradeCreateRequest.BizContent bizContent=new AliPayTradeCreateRequest.BizContent();\n bizContent.setOutTradeNo(request.getOrderId());\n bizContent.setTotalAmount(request.getOrderAmount());\n bizContent.setSubject(request.getOrderName());\n bizContent.setPassbackParams(request.getAttach());\n aliPayOrderQueryRequest.setBizContent(JsonUtil.toJsonWithUnderscores(bizContent).replaceAll(\"\\\\s*\",\"\"));\n String sign=AliPaySignature.sign(MapUtil.object2MapWithUnderline(aliPayOrderQueryRequest),aliPayConfig.getPrivateKey());\n aliPayOrderQueryRequest.setSign(URLEncoder.encode(sign));\n Map<String,String> stringStringMap=MapUtil.object2MapWithUnderline(aliPayOrderQueryRequest);\n String body=MapUtil.toUrl(stringStringMap);\n PayResponse payResponse=new PayResponse();\n payResponse.setBody(body);\n return payResponse;\n}\n"}}]
pmd_pmd
pmd/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/multithreading/DoubleCheckedLockingRule.java
DoubleCheckedLockingRule
visit
class DoubleCheckedLockingRule extends AbstractJavaRule { @Override protected @NonNull RuleTargetSelector buildTargetSelector() { return RuleTargetSelector.forTypes(ASTMethodDeclaration.class); } @Override public Object visit(ASTMethodDeclaration node, Object data) {<FILL_FUNCTION_BODY>} private boolean isLocalOnlyStoredWithVolatileField(ASTMethodDeclaration method, JVariableSymbol local) { ASTExpression initializer; if (local instanceof JLocalVariableSymbol) { ASTVariableId id = local.tryGetNode(); if (id == null) { return false; } initializer = id.getInitializer(); } else { // the return variable name doesn't seem to be a local variable return false; } return (initializer == null || isVolatileFieldReference(initializer)) && method.descendants(ASTAssignmentExpression.class) .filter(it -> JavaAstUtils.isReferenceToVar(it.getLeftOperand(), local)) .all(it -> isVolatileFieldReference(it.getRightOperand())); } private boolean isVolatileFieldReference(@Nullable ASTExpression initializer) { if (initializer instanceof ASTNamedReferenceExpr) { JVariableSymbol fieldSym = ((ASTNamedReferenceExpr) initializer).getReferencedSym(); return fieldSym instanceof JFieldSymbol && Modifier.isVolatile(((JFieldSymbol) fieldSym).getModifiers()); } else { return false; } } }
if (node.isVoid() || node.getResultTypeNode() instanceof ASTPrimitiveType || node.getBody() == null) { return data; } List<ASTReturnStatement> rsl = node.descendants(ASTReturnStatement.class).toList(); if (rsl.size() != 1) { return data; } ASTReturnStatement rs = rsl.get(0); ASTExpression returnExpr = rs.getExpr(); if (!(returnExpr instanceof ASTNamedReferenceExpr)) { return data; } JVariableSymbol returnVariable = ((ASTNamedReferenceExpr) returnExpr).getReferencedSym(); // With Java5 and volatile keyword, DCL is no longer an issue if (returnVariable instanceof JFieldSymbol && Modifier.isVolatile(((JFieldSymbol) returnVariable).getModifiers())) { return data; } // if the return variable is local and only written with the volatile // field, then it's ok, too if (isLocalOnlyStoredWithVolatileField(node, returnVariable)) { return data; } List<ASTIfStatement> isl = node.descendants(ASTIfStatement.class).toList(); if (isl.size() == 2) { ASTIfStatement outerIf = isl.get(0); if (JavaRuleUtil.isNullCheck(outerIf.getCondition(), returnVariable)) { // find synchronized List<ASTSynchronizedStatement> ssl = outerIf.descendants(ASTSynchronizedStatement.class).toList(); if (ssl.size() == 1 && ssl.get(0).ancestors().any(it -> it == outerIf)) { ASTIfStatement is2 = isl.get(1); if (JavaRuleUtil.isNullCheck(is2.getCondition(), returnVariable)) { List<ASTAssignmentExpression> assignments = is2.descendants(ASTAssignmentExpression.class).toList(); if (assignments.size() == 1 && JavaAstUtils.isReferenceToVar(assignments.get(0).getLeftOperand(), returnVariable)) { asCtx(data).addViolation(node); } } } } } return data;
ASTMethodDeclaration method = (ASTMethodDeclaration) node; List<JVariableSymbol> localVars = method.getLocalVariables(); for (JVariableSymbol local : localVars) { if (isLocalOnlyStoredWithVolatileField(method, local)) { addViolation(data, method, local); } } return data;
[ "List<JVariableSymbol>", "JVariableSymbol", "ASTMethodDeclaration" ]
[ "getLocalVariables" ]
[ "ASTIfStatement", "ASTReturnStatement", "List<ASTReturnStatement>", "ASTExpression", "List<ASTIfStatement>", "ASTMethodDeclaration", "List<ASTSynchronizedStatement>", "List<ASTAssignmentExpression>", "JVariableSymbol" ]
[ "descendants", "isVolatile", "isNullCheck", "getLeftOperand", "getBody", "getExpr", "isReferenceToVar", "addViolation", "getCondition", "get", "isVoid", "ancestors", "getResultTypeNode", "toList", "size", "getReferencedSym", "getModifiers", "any" ]
{ "methods": [ "getLocalVariables" ], "similar_methods": [ "visit" ], "types": [ "List<JVariableSymbol>", "JVariableSymbol", "ASTMethodDeclaration" ] }
/** * Reference to a variable, ie {@linkplain JLocalVariableSymbol local variable}, {@linkplain JFormalParamSymbol formal parameter}, or {@linkplain JFieldSymbol field}. * @since 7.0.0 */ public interface JVariableSymbol extends BoundToNode<ASTVariableId>, AnnotableSymbol { /** * Returns true if this is a field symbol. * @see JFieldSymbol */ default boolean isField(); /** * Returns true if this declaration is declared final. This takes implicit modifiers into account. */ boolean isFinal(); /** * Returns the type of this value, under the given substitution. */ JTypeMirror getTypeMirror( Substitution subst); } /** * A method declaration, in a class or interface declaration. Since 7.0, this also represents annotation methods. Annotation methods have a much more restricted grammar though, in particular: <ul> <li>They can't declare a {@linkplain #getThrowsList() throws clause}<li>They can't declare {@linkplain #getTypeParameters() type parameters}<li>Their {@linkplain #getFormalParameters() formal parameters} must be empty<li>They can't be declared void <li>They must be abstract </ul> They can however declare a {@link #getDefaultClause() default value}. <pre class="grammar"> MethodDeclaration ::= {@link ASTModifierList ModifierList}{@link ASTTypeParameters TypeParameters}? {@link ASTType Type}&lt;IDENTIFIER&gt; {@link ASTFormalParameters FormalParameters}{@link ASTArrayDimensions ArrayDimensions}? {@link ASTThrowsList ThrowsList}? ( {@link ASTBlock Block} | ";" )</pre> */ public final class ASTMethodDeclaration extends AbstractExecutableDeclaration<JMethodSymbol> { private String name; /** * Populated by {@link OverrideResolutionPass}. */ private JMethodSig overriddenMethod=null; ASTMethodDeclaration( int id); @Override protected <P,R>R acceptVisitor( JavaVisitor<? super P,? extends R> visitor, P data); /** * Returns true if this method is overridden. */ public boolean isOverridden(); /** * Returns the signature of the method this method overrides in a supertype. Note that this method may be implementing several methods of super-interfaces at once, in that case, an arbitrary one is returned. <p>If the method has an {@link Override} annotation, but we couldn'tresolve any method that is actually implemented, this will return {@link TypeSystem#UNRESOLVED_METHOD}. */ public JMethodSig getOverriddenMethod(); void setOverriddenMethod( JMethodSig overriddenMethod); @Override public FileLocation getReportLocation(); /** * Returns the simple name of the method. */ @Override public String getName(); void setName( String name); /** * If this method declaration is an explicit record component accessor, returns the corresponding record component. Otherwise returns null. */ public @Nullable ASTRecordComponent getAccessedRecordComponent(); /** * Returns true if the result type of this method is {@code void}. */ public boolean isVoid(); /** * Returns the default clause, if this is an annotation method declaration that features one. Otherwise returns null. */ @Nullable public ASTDefaultValue getDefaultClause(); /** * Returns the result type node of the method. This may be a {@link ASTVoidType}. */ public @NonNull ASTType getResultTypeNode(); /** * Returns the extra array dimensions that may be after the formal parameters. */ @Nullable public ASTArrayDimensions getExtraDimensions(); /** * Returns whether this is a main method declaration. */ public boolean isMainMethod(); /** * With JEP 445 (Java 21 Preview) the main method does not need to be static anymore and does not need to be public or have a formal parameter. */ private boolean isMainMethodUnnamedClass(); } public List<Pair<String,String>> getVariables(){ return this.variables; } default R visit(ASTWhenClause node,P data){ return visitModelicaNode(node,data); }
public interface JVariableSymbol extends BoundToNode<ASTVariableId>, AnnotableSymbol { default boolean isField(); boolean isFinal(); JTypeMirror getTypeMirror( Substitution subst); } public final class ASTMethodDeclaration extends AbstractExecutableDeclaration<JMethodSymbol> { private String name; private JMethodSig overriddenMethod=null; ASTMethodDeclaration( int id); protected <P,R>R acceptVisitor( JavaVisitor<? super P,? extends R> visitor, P data); public boolean isOverridden(); public JMethodSig getOverriddenMethod(); void setOverriddenMethod( JMethodSig overriddenMethod); public FileLocation getReportLocation(); public String getName(); void setName( String name); public ASTRecordComponent getAccessedRecordComponent(); public boolean isVoid(); public ASTDefaultValue getDefaultClause(); public ASTType getResultTypeNode(); public ASTArrayDimensions getExtraDimensions(); public boolean isMainMethod(); private boolean isMainMethodUnnamedClass(); } public List<Pair<String,String>> getVariables(){ return this.variables; } default R visit(ASTWhenClause node,P data){ return visitModelicaNode(node,data); }
{"types": [{"List<JVariableSymbol>": "JVariableSymbol"}, {"JVariableSymbol": "JVariableSymbol"}, {"ASTMethodDeclaration": "ASTMethodDeclaration"}], "methods": [{"getLocalVariables": "getVariables"}], "similar_methods": [{"visit": "visit"}]}
[{"List<JVariableSymbol>": {"retrieved_name": "JVariableSymbol", "raw_body": "/** \n * Reference to a variable, ie {@linkplain JLocalVariableSymbol local variable}, {@linkplain JFormalParamSymbol formal parameter}, or {@linkplain JFieldSymbol field}.\n * @since 7.0.0\n */\npublic interface JVariableSymbol extends BoundToNode<ASTVariableId>, AnnotableSymbol {\n /** \n * Returns true if this is a field symbol.\n * @see JFieldSymbol\n */\n default boolean isField();\n /** \n * Returns true if this declaration is declared final. This takes implicit modifiers into account.\n */\n boolean isFinal();\n /** \n * Returns the type of this value, under the given substitution. \n */\n JTypeMirror getTypeMirror( Substitution subst);\n}\n", "raw_body_no_cmt": "public interface JVariableSymbol extends BoundToNode<ASTVariableId>, AnnotableSymbol {\n default boolean isField();\n boolean isFinal();\n JTypeMirror getTypeMirror( Substitution subst);\n}\n"}}, {"ASTMethodDeclaration": {"retrieved_name": "ASTMethodDeclaration", "raw_body": "/** \n * A method declaration, in a class or interface declaration. Since 7.0, this also represents annotation methods. Annotation methods have a much more restricted grammar though, in particular: <ul> <li>They can't declare a {@linkplain #getThrowsList() throws clause}<li>They can't declare {@linkplain #getTypeParameters() type parameters}<li>Their {@linkplain #getFormalParameters() formal parameters} must be empty<li>They can't be declared void <li>They must be abstract </ul> They can however declare a {@link #getDefaultClause() default value}. <pre class=\"grammar\"> MethodDeclaration ::= {@link ASTModifierList ModifierList}{@link ASTTypeParameters TypeParameters}? {@link ASTType Type}&lt;IDENTIFIER&gt; {@link ASTFormalParameters FormalParameters}{@link ASTArrayDimensions ArrayDimensions}? {@link ASTThrowsList ThrowsList}? ( {@link ASTBlock Block} | \";\" )</pre>\n */\npublic final class ASTMethodDeclaration extends AbstractExecutableDeclaration<JMethodSymbol> {\n private String name;\n /** \n * Populated by {@link OverrideResolutionPass}.\n */\n private JMethodSig overriddenMethod=null;\n ASTMethodDeclaration( int id);\n @Override protected <P,R>R acceptVisitor( JavaVisitor<? super P,? extends R> visitor, P data);\n /** \n * Returns true if this method is overridden.\n */\n public boolean isOverridden();\n /** \n * Returns the signature of the method this method overrides in a supertype. Note that this method may be implementing several methods of super-interfaces at once, in that case, an arbitrary one is returned. <p>If the method has an {@link Override} annotation, but we couldn'tresolve any method that is actually implemented, this will return {@link TypeSystem#UNRESOLVED_METHOD}.\n */\n public JMethodSig getOverriddenMethod();\n void setOverriddenMethod( JMethodSig overriddenMethod);\n @Override public FileLocation getReportLocation();\n /** \n * Returns the simple name of the method. \n */\n @Override public String getName();\n void setName( String name);\n /** \n * If this method declaration is an explicit record component accessor, returns the corresponding record component. Otherwise returns null.\n */\n public @Nullable ASTRecordComponent getAccessedRecordComponent();\n /** \n * Returns true if the result type of this method is {@code void}.\n */\n public boolean isVoid();\n /** \n * Returns the default clause, if this is an annotation method declaration that features one. Otherwise returns null.\n */\n @Nullable public ASTDefaultValue getDefaultClause();\n /** \n * Returns the result type node of the method. This may be a {@link ASTVoidType}.\n */\n public @NonNull ASTType getResultTypeNode();\n /** \n * Returns the extra array dimensions that may be after the formal parameters.\n */\n @Nullable public ASTArrayDimensions getExtraDimensions();\n /** \n * Returns whether this is a main method declaration.\n */\n public boolean isMainMethod();\n /** \n * With JEP 445 (Java 21 Preview) the main method does not need to be static anymore and does not need to be public or have a formal parameter.\n */\n private boolean isMainMethodUnnamedClass();\n}\n", "raw_body_no_cmt": "public final class ASTMethodDeclaration extends AbstractExecutableDeclaration<JMethodSymbol> {\n private String name;\n private JMethodSig overriddenMethod=null;\n ASTMethodDeclaration( int id);\n protected <P,R>R acceptVisitor( JavaVisitor<? super P,? extends R> visitor, P data);\n public boolean isOverridden();\n public JMethodSig getOverriddenMethod();\n void setOverriddenMethod( JMethodSig overriddenMethod);\n public FileLocation getReportLocation();\n public String getName();\n void setName( String name);\n public ASTRecordComponent getAccessedRecordComponent();\n public boolean isVoid();\n public ASTDefaultValue getDefaultClause();\n public ASTType getResultTypeNode();\n public ASTArrayDimensions getExtraDimensions();\n public boolean isMainMethod();\n private boolean isMainMethodUnnamedClass();\n}\n"}}]
[{"getLocalVariables": {"retrieved_name": "getVariables", "raw_body": "public List<Pair<String,String>> getVariables(){\n return this.variables;\n}\n"}}]
[{"visit": {"retrieved_name": "visit", "raw_body": "default R visit(ASTWhenClause node,P data){\n return visitModelicaNode(node,data);\n}\n"}}]
subhra74_snowflake
snowflake/muon-app/src/main/java/muon/app/ui/laf/AppSkinDark.java
AppSkinDark
initDefaultsDark
class AppSkinDark extends AppSkin { /** * */ public AppSkinDark() { initDefaultsDark(); } private void initDefaultsDark() {<FILL_FUNCTION_BODY>} }
Color selectionColor = new Color(3, 155, 229); Color controlColor = new Color(40, 44, 52); Color textColor = new Color(230, 230, 230); Color selectedTextColor = new Color(230, 230, 230); Color infoTextColor = new Color(180, 180, 180); Color borderColor = new Color(24, 26, 31); Color treeTextColor = new Color(75 + 20, 83 + 20, 98 + 20); Color scrollbarColor = new Color(75, 83, 98); Color scrollbarRolloverColor = new Color(75 + 20, 83 + 20, 98 + 20); Color textFieldColor = new Color(40 + 10, 44 + 10, 52 + 10); Color buttonGradient1 = new Color(57, 62, 74); Color buttonGradient2 = new Color(55 - 10, 61 - 10, 72 - 10); Color buttonGradient3 = new Color(57 + 20, 62 + 20, 74 + 20); Color buttonGradient4 = new Color(57 + 10, 62 + 10, 74 + 10); Color buttonGradient5 = new Color(57 - 20, 62 - 20, 74 - 20); Color buttonGradient6 = new Color(57 - 10, 62 - 10, 74 - 10); this.defaults.put("nimbusBase", controlColor); this.defaults.put("nimbusSelection", selectionColor); this.defaults.put("textBackground", selectionColor); this.defaults.put("textHighlight", selectionColor); this.defaults.put("desktop", selectionColor); this.defaults.put("nimbusFocus", selectionColor); this.defaults.put("ArrowButton.foreground", textColor); this.defaults.put("nimbusSelectionBackground", selectionColor); this.defaults.put("nimbusSelectedText", selectedTextColor); this.defaults.put("control", controlColor); this.defaults.put("nimbusBorder", borderColor); this.defaults.put("Table.alternateRowColor", controlColor); this.defaults.put("nimbusLightBackground", textFieldColor); this.defaults.put("tabSelectionBackground", scrollbarColor); this.defaults.put("Table.background", buttonGradient6); this.defaults.put("Table[Enabled+Selected].textForeground", selectedTextColor); // this.defaults.put("scrollbar", buttonGradient4); // this.defaults.put("scrollbar-hot", buttonGradient3); this.defaults.put("text", textColor); this.defaults.put("menuText", textColor); this.defaults.put("controlText", textColor); this.defaults.put("textForeground", textColor); this.defaults.put("infoText", infoTextColor); this.defaults.put("List.foreground", textColor); this.defaults.put("List.background", controlColor); this.defaults.put("List[Disabled].textForeground", selectedTextColor); this.defaults.put("List[Selected].textBackground", selectionColor); this.defaults.put("Label.foreground", textColor); this.defaults.put("Tree.background", textFieldColor); this.defaults.put("Tree.textForeground", treeTextColor); this.defaults.put("scrollbar", scrollbarColor); this.defaults.put("scrollbar-hot", scrollbarRolloverColor); this.defaults.put("button.normalGradient1", buttonGradient1); this.defaults.put("button.normalGradient2", buttonGradient2); this.defaults.put("button.hotGradient1", buttonGradient3); this.defaults.put("button.hotGradient2", buttonGradient4); this.defaults.put("button.pressedGradient1", buttonGradient5); this.defaults.put("button.pressedGradient2", buttonGradient6); this.defaults.put("TextField.background", textFieldColor); this.defaults.put("FormattedTextField.background", textFieldColor); this.defaults.put("PasswordField.background", textFieldColor); createSkinnedButton(this.defaults); createTextFieldSkin(this.defaults); createSpinnerSkin(this.defaults); createComboBoxSkin(this.defaults); createTreeSkin(this.defaults); createTableHeaderSkin(this.defaults); createPopupMenuSkin(this.defaults); createCheckboxSkin(this.defaults); createRadioButtonSkin(this.defaults); createTooltipSkin(this.defaults); createSkinnedToggleButton(this.defaults); createProgressBarSkin(this.defaults); this.defaults.put("ScrollBarUI", CustomScrollBarUI.class.getName());
/** * @author subhro */ public abstract class AppSkin { protected UIDefaults defaults; protected NimbusLookAndFeel laf; /** */ public AppSkin(); private void initDefaults(); /** * @return the laf */ public NimbusLookAndFeel getLaf(); protected Font loadFonts(); protected Font loadFontAwesomeFonts(); public Color getDefaultBackground(); public Color getDefaultForeground(); public Color getDefaultSelectionForeground(); public Color getDefaultSelectionBackground(); public Color getDefaultBorderColor(); public Font getIconFont(); public Font getDefaultFont(); public Color getInfoTextForeground(); public Color getAddressBarSelectionBackground(); public Color getAddressBarRolloverBackground(); public UIDefaults getSplitPaneSkin(); public void createSkinnedButton( UIDefaults btnSkin); public void createTextFieldSkin( UIDefaults uiDefaults); public void createSpinnerSkin( UIDefaults uiDefaults); public void createComboBoxSkin( UIDefaults uiDefaults); public void createTreeSkin( UIDefaults uiDefaults); public UIDefaults createToolbarSkin(); public UIDefaults createTabButtonSkin(); public void createTableHeaderSkin( UIDefaults uiDefaults); public void createPopupMenuSkin( UIDefaults uiDefaults); public Color getTableBackgroundColor(); public Color getSelectedTabColor(); public Color getTextFieldBackground(); public void createCheckboxSkin( UIDefaults uiDefaults); public void createRadioButtonSkin( UIDefaults uiDefaults); public void createTooltipSkin( UIDefaults uiDefaults); public void createSkinnedToggleButton( UIDefaults btnSkin); public void createProgressBarSkin( UIDefaults uiDefaults); }
defaults.put("Button.background", new Color(20, 20, 20)); defaults.put("Button.foreground", Color.WHITE); defaults.put("Button.borderColor", Color.BLACK); defaults.put("Button.borderPainted", true); defaults.put("Button.focusPainted", false); defaults.put("Button.arc", 0); defaults.put("Button.contentAreaFilled", false); defaults.put("Button.focus", false); defaults.put("Button.focusHighlight", false); defaults.put("Button.focusHighlightColor", Color.BLACK); defaults.put("Button.focusHighlightColor", Color.BLACK); defaults.put("Button.focusHighlightColor", Color.BLACK); defaults.put("Button.focusHighlightColor", Color.BLACK); defaults.put("Button.focusHighlightColor", Color.BLACK); defaults.put("Button.focusHighlightColor", Color.BLACK); defaults.put("Button.focusHighlightColor", Color.BLACK); defaults.put("Button.focusHighlightColor", Color.BLACK); defaults.put("Button.focusHighlightColor", Color.BLACK); defaults.put("Button.focusHighlightColor", Color.BLACK); defaults.put("Button.focusHighlightColor", Color.BLACK); defaults.put("Button.focusHighlightColor", Color.BLACK);
[]
[ "put" ]
[ "Color" ]
[ "getName", "put" ]
{ "methods": [ "put" ], "similar_methods": [ "initDefaultsDark" ], "types": [] }
private void put(CharBuffer characters,Pair<Integer,Integer> range){ if (ranges.containsKey(characters)) { ranges.get(characters).add(range); } else { ArrayList<Pair<Integer,Integer>> list=new ArrayList<>(); list.add(range); ranges.put(characters,list); } } private void initDefaultsLight(){ Color selectionColor=new Color(3,155,229); Color controlColor=Color.WHITE; Color textColor=new Color(60,60,60); Color selectedTextColor=new Color(250,250,250); Color infoTextColor=new Color(80,80,80); Color borderColor=new Color(230,230,230); Color treeTextColor=new Color(150,150,150); Color scrollbarColor=new Color(200,200,200); Color scrollbarRolloverColor=new Color(230,230,230); Color textFieldColor=new Color(250,250,250); Color buttonGradient1=new Color(250,250,250); Color buttonGradient2=new Color(240,240,240); Color buttonGradient3=new Color(245,245,245); Color buttonGradient4=new Color(235,235,235); Color buttonGradient5=new Color(230,230,230); Color buttonGradient6=new Color(220,220,220); this.defaults.put("nimbusBase",controlColor); this.defaults.put("nimbusSelection",selectionColor); this.defaults.put("textBackground",selectionColor); this.defaults.put("textHighlight",selectionColor); this.defaults.put("desktop",selectionColor); this.defaults.put("nimbusFocus",selectionColor); this.defaults.put("ArrowButton.foreground",textColor); this.defaults.put("nimbusSelectionBackground",selectionColor); this.defaults.put("nimbusSelectedText",selectedTextColor); this.defaults.put("control",controlColor); this.defaults.put("nimbusBorder",borderColor); this.defaults.put("nimbusLightBackground",controlColor); this.defaults.put("Table.alternateRowColor",controlColor); this.defaults.put("tabSelectionBackground",scrollbarColor); this.defaults.put("Table.background",buttonGradient1); this.defaults.put("Table[Enabled+Selected].textForeground",selectedTextColor); this.defaults.put("text",textColor); this.defaults.put("menuText",textColor); this.defaults.put("controlText",textColor); this.defaults.put("textForeground",textColor); this.defaults.put("infoText",infoTextColor); this.defaults.put("List.foreground",textColor); this.defaults.put("List.background",controlColor); this.defaults.put("List[Disabled].textForeground",selectedTextColor); this.defaults.put("List[Selected].textBackground",selectionColor); this.defaults.put("Label.foreground",textColor); this.defaults.put("Tree.background",textFieldColor); this.defaults.put("Tree.textForeground",treeTextColor); this.defaults.put("scrollbar",scrollbarColor); this.defaults.put("scrollbar-hot",scrollbarRolloverColor); this.defaults.put("button.normalGradient1",buttonGradient1); this.defaults.put("button.normalGradient2",buttonGradient2); this.defaults.put("button.hotGradient1",buttonGradient3); this.defaults.put("button.hotGradient2",buttonGradient4); this.defaults.put("button.pressedGradient1",buttonGradient5); this.defaults.put("button.pressedGradient2",buttonGradient6); this.defaults.put("TextField.background",textFieldColor); this.defaults.put("FormattedTextField.background",textFieldColor); this.defaults.put("PasswordField.background",textFieldColor); createSkinnedButton(this.defaults); createTextFieldSkin(this.defaults); createSpinnerSkin(this.defaults); createComboBoxSkin(this.defaults); createTreeSkin(this.defaults); createTableHeaderSkin(this.defaults); createPopupMenuSkin(this.defaults); createCheckboxSkin(this.defaults); createRadioButtonSkin(this.defaults); createTooltipSkin(this.defaults); createSkinnedToggleButton(this.defaults); createProgressBarSkin(this.defaults); this.defaults.put("ScrollBarUI",CustomScrollBarUI.class.getName()); }
private void put(CharBuffer characters,Pair<Integer,Integer> range){ if (ranges.containsKey(characters)) { ranges.get(characters).add(range); } else { ArrayList<Pair<Integer,Integer>> list=new ArrayList<>(); list.add(range); ranges.put(characters,list); } } private void initDefaultsLight(){ Color selectionColor=new Color(3,155,229); Color controlColor=Color.WHITE; Color textColor=new Color(60,60,60); Color selectedTextColor=new Color(250,250,250); Color infoTextColor=new Color(80,80,80); Color borderColor=new Color(230,230,230); Color treeTextColor=new Color(150,150,150); Color scrollbarColor=new Color(200,200,200); Color scrollbarRolloverColor=new Color(230,230,230); Color textFieldColor=new Color(250,250,250); Color buttonGradient1=new Color(250,250,250); Color buttonGradient2=new Color(240,240,240); Color buttonGradient3=new Color(245,245,245); Color buttonGradient4=new Color(235,235,235); Color buttonGradient5=new Color(230,230,230); Color buttonGradient6=new Color(220,220,220); this.defaults.put("nimbusBase",controlColor); this.defaults.put("nimbusSelection",selectionColor); this.defaults.put("textBackground",selectionColor); this.defaults.put("textHighlight",selectionColor); this.defaults.put("desktop",selectionColor); this.defaults.put("nimbusFocus",selectionColor); this.defaults.put("ArrowButton.foreground",textColor); this.defaults.put("nimbusSelectionBackground",selectionColor); this.defaults.put("nimbusSelectedText",selectedTextColor); this.defaults.put("control",controlColor); this.defaults.put("nimbusBorder",borderColor); this.defaults.put("nimbusLightBackground",controlColor); this.defaults.put("Table.alternateRowColor",controlColor); this.defaults.put("tabSelectionBackground",scrollbarColor); this.defaults.put("Table.background",buttonGradient1); this.defaults.put("Table[Enabled+Selected].textForeground",selectedTextColor); this.defaults.put("text",textColor); this.defaults.put("menuText",textColor); this.defaults.put("controlText",textColor); this.defaults.put("textForeground",textColor); this.defaults.put("infoText",infoTextColor); this.defaults.put("List.foreground",textColor); this.defaults.put("List.background",controlColor); this.defaults.put("List[Disabled].textForeground",selectedTextColor); this.defaults.put("List[Selected].textBackground",selectionColor); this.defaults.put("Label.foreground",textColor); this.defaults.put("Tree.background",textFieldColor); this.defaults.put("Tree.textForeground",treeTextColor); this.defaults.put("scrollbar",scrollbarColor); this.defaults.put("scrollbar-hot",scrollbarRolloverColor); this.defaults.put("button.normalGradient1",buttonGradient1); this.defaults.put("button.normalGradient2",buttonGradient2); this.defaults.put("button.hotGradient1",buttonGradient3); this.defaults.put("button.hotGradient2",buttonGradient4); this.defaults.put("button.pressedGradient1",buttonGradient5); this.defaults.put("button.pressedGradient2",buttonGradient6); this.defaults.put("TextField.background",textFieldColor); this.defaults.put("FormattedTextField.background",textFieldColor); this.defaults.put("PasswordField.background",textFieldColor); createSkinnedButton(this.defaults); createTextFieldSkin(this.defaults); createSpinnerSkin(this.defaults); createComboBoxSkin(this.defaults); createTreeSkin(this.defaults); createTableHeaderSkin(this.defaults); createPopupMenuSkin(this.defaults); createCheckboxSkin(this.defaults); createRadioButtonSkin(this.defaults); createTooltipSkin(this.defaults); createSkinnedToggleButton(this.defaults); createProgressBarSkin(this.defaults); this.defaults.put("ScrollBarUI",CustomScrollBarUI.class.getName()); }
{"methods": [{"put": "put"}], "similar_methods": [{"initDefaultsDark": "initDefaultsLight"}]}
[]
[{"put": {"retrieved_name": "put", "raw_body": "private void put(CharBuffer characters,Pair<Integer,Integer> range){\n if (ranges.containsKey(characters)) {\n ranges.get(characters).add(range);\n }\n else {\n ArrayList<Pair<Integer,Integer>> list=new ArrayList<>();\n list.add(range);\n ranges.put(characters,list);\n }\n}\n"}}]
[{"initDefaultsDark": {"retrieved_name": "initDefaultsLight", "raw_body": "private void initDefaultsLight(){\n Color selectionColor=new Color(3,155,229);\n Color controlColor=Color.WHITE;\n Color textColor=new Color(60,60,60);\n Color selectedTextColor=new Color(250,250,250);\n Color infoTextColor=new Color(80,80,80);\n Color borderColor=new Color(230,230,230);\n Color treeTextColor=new Color(150,150,150);\n Color scrollbarColor=new Color(200,200,200);\n Color scrollbarRolloverColor=new Color(230,230,230);\n Color textFieldColor=new Color(250,250,250);\n Color buttonGradient1=new Color(250,250,250);\n Color buttonGradient2=new Color(240,240,240);\n Color buttonGradient3=new Color(245,245,245);\n Color buttonGradient4=new Color(235,235,235);\n Color buttonGradient5=new Color(230,230,230);\n Color buttonGradient6=new Color(220,220,220);\n this.defaults.put(\"nimbusBase\",controlColor);\n this.defaults.put(\"nimbusSelection\",selectionColor);\n this.defaults.put(\"textBackground\",selectionColor);\n this.defaults.put(\"textHighlight\",selectionColor);\n this.defaults.put(\"desktop\",selectionColor);\n this.defaults.put(\"nimbusFocus\",selectionColor);\n this.defaults.put(\"ArrowButton.foreground\",textColor);\n this.defaults.put(\"nimbusSelectionBackground\",selectionColor);\n this.defaults.put(\"nimbusSelectedText\",selectedTextColor);\n this.defaults.put(\"control\",controlColor);\n this.defaults.put(\"nimbusBorder\",borderColor);\n this.defaults.put(\"nimbusLightBackground\",controlColor);\n this.defaults.put(\"Table.alternateRowColor\",controlColor);\n this.defaults.put(\"tabSelectionBackground\",scrollbarColor);\n this.defaults.put(\"Table.background\",buttonGradient1);\n this.defaults.put(\"Table[Enabled+Selected].textForeground\",selectedTextColor);\n this.defaults.put(\"text\",textColor);\n this.defaults.put(\"menuText\",textColor);\n this.defaults.put(\"controlText\",textColor);\n this.defaults.put(\"textForeground\",textColor);\n this.defaults.put(\"infoText\",infoTextColor);\n this.defaults.put(\"List.foreground\",textColor);\n this.defaults.put(\"List.background\",controlColor);\n this.defaults.put(\"List[Disabled].textForeground\",selectedTextColor);\n this.defaults.put(\"List[Selected].textBackground\",selectionColor);\n this.defaults.put(\"Label.foreground\",textColor);\n this.defaults.put(\"Tree.background\",textFieldColor);\n this.defaults.put(\"Tree.textForeground\",treeTextColor);\n this.defaults.put(\"scrollbar\",scrollbarColor);\n this.defaults.put(\"scrollbar-hot\",scrollbarRolloverColor);\n this.defaults.put(\"button.normalGradient1\",buttonGradient1);\n this.defaults.put(\"button.normalGradient2\",buttonGradient2);\n this.defaults.put(\"button.hotGradient1\",buttonGradient3);\n this.defaults.put(\"button.hotGradient2\",buttonGradient4);\n this.defaults.put(\"button.pressedGradient1\",buttonGradient5);\n this.defaults.put(\"button.pressedGradient2\",buttonGradient6);\n this.defaults.put(\"TextField.background\",textFieldColor);\n this.defaults.put(\"FormattedTextField.background\",textFieldColor);\n this.defaults.put(\"PasswordField.background\",textFieldColor);\n createSkinnedButton(this.defaults);\n createTextFieldSkin(this.defaults);\n createSpinnerSkin(this.defaults);\n createComboBoxSkin(this.defaults);\n createTreeSkin(this.defaults);\n createTableHeaderSkin(this.defaults);\n createPopupMenuSkin(this.defaults);\n createCheckboxSkin(this.defaults);\n createRadioButtonSkin(this.defaults);\n createTooltipSkin(this.defaults);\n createSkinnedToggleButton(this.defaults);\n createProgressBarSkin(this.defaults);\n this.defaults.put(\"ScrollBarUI\",CustomScrollBarUI.class.getName());\n}\n"}}]
spring-cloud_spring-cloud-gateway
"spring-cloud-gateway/spring-cloud-gateway-server/src/main/java/org/springframework/cloud/gateway/fi(...TRUNCATED)
ReactiveLoadBalancerClientFilter
choose
"class ReactiveLoadBalancerClientFilter implements GlobalFilter, Ordered {\n\n\tprivate static final(...TRUNCATED)
"\n\t\tReactorLoadBalancer<ServiceInstance> loadBalancer = this.clientFactory.getInstance(serviceId,(...TRUNCATED)
"\n\t\tLoadBalancerProperties loadBalancerProperties = clientFactory.getProperties(serviceId);\n\t\t(...TRUNCATED)
["LoadBalancerClientFactory","LoadBalancerClient","LoadBalancerProperties","Set<LoadBalancerLifecycl(...TRUNCATED)
[ "getLazyProvider", "choose", "onStart", "doOnNext", "getIfAvailable", "forEach", "getProperties" ]
["ReactorLoadBalancer<ServiceInstance>","Set<LoadBalancerLifecycle>","Request<RequestDataContext>","(...TRUNCATED)
[ "getInstance", "onStart", "forEach", "choose" ]
{"methods":["getLazyProvider","choose","onStart","doOnNext","getIfAvailable","forEach","getPropertie(...TRUNCATED)
"public class LoadBalancerHandlerSupplier implements HandlerSupplier {\n @Override public Collectio(...TRUNCATED)
"public class LoadBalancerHandlerSupplier implements HandlerSupplier {\n public Collection<Method> (...TRUNCATED)
"{\"types\": [{\"LoadBalancerClientFactory\": \"LoadBalancerHandlerSupplier\"}, {\"LoadBalancerClien(...TRUNCATED)
"[{\"LoadBalancerClientFactory\": {\"retrieved_name\": \"LoadBalancerHandlerSupplier\", \"raw_body\"(...TRUNCATED)
"[{\"getLazyProvider\": {\"retrieved_name\": \"getKeyStoreProvider\", \"raw_body\": \"public String (...TRUNCATED)
"[{\"choose\": {\"retrieved_name\": \"options\", \"raw_body\": \"@Override public RequestHeadersUriS(...TRUNCATED)
PlexPt_chatgpt-java
chatgpt-java/src/main/java/com/plexpt/chatgpt/Images.java
Images
init
"class Images {\n /**\n * keys\n */\n private String apiKey;\n\n private List<Strin(...TRUNCATED)
"\n OkHttpClient.Builder client = new OkHttpClient.Builder();\n client.addInterceptor((...TRUNCATED)
"\n this.apiClient = new Api(this.apiKey,this.apiKeyList,this.apiHost,this.okHttpClient,this.(...TRUNCATED)
[ "Proxy", "OkHttpClient", "List<String>", "Api" ]
[]
["BaseResponse","OkHttpClient.Builder","List<String>","Request","Api","Response","OkHttpClient","Pro(...TRUNCATED)
["body","addConverterFactory","parseObject","create","method","newBuilder","build","isEmpty","string(...TRUNCATED)
{ "methods": [], "similar_methods": [ "init" ], "types": [ "Proxy", "OkHttpClient", "List<String>", "Api" ] }
"@UtilityClass public class Proxys {\n /** \n * http 代理\n * @param ip\n * @param port\n * @retu(...TRUNCATED)
"public class Proxys {\n public static Proxy http( String ip, int port);\n public static Proxy s(...TRUNCATED)
"{\"types\": [{\"Proxy\": \"Proxys\"}, {\"OkHttpClient\": \"ChatContextHolder\"}, {\"List<String>\":(...TRUNCATED)
"[{\"Proxy\": {\"retrieved_name\": \"Proxys\", \"raw_body\": \"@UtilityClass public class Proxys {\\(...TRUNCATED)
[]
"[{\"init\": {\"retrieved_name\": \"init\", \"raw_body\": \"/** \\n * \\u521d\\u59cb\\u5316\\n */\\n(...TRUNCATED)

No dataset card yet

New: Create and edit this dataset card directly on the website!

Contribute a Dataset Card
Downloads last month
6
Add dataset card