code
stringlengths
146
466k
prompt
stringlengths
54
1.5k
Of course, here is the Java code you requested: ```java @Override public void removeByResource(Resource resource) { checkNotNull(resource,"Resource cannot be null"); this.lock.writeLock().lock(); try { ResourceId resourceId = resource.id(); for(String constraintsId:this.failureIds.get(resourceId)) { t...
Create a Java method that does the following: "Removes all constraints for the given resource from the constraint report.".
Of course, here is the Java code you requested: ```java @Override public void shutdown() throws LifecycleException { this.lock.writeLock().lock(); try { this.reports.clear(); } finally { this.lock.writeLock().unlock(); } } ``` Hope this helps!
Create a Java method that does the following: "Shutdown the service.".
Of course, here is the Java code you requested: ```java @Override public Set<AttachedTemplate> attachedTemplates() { return Collections.unmodifiableSet(new LinkedHashSet<AttachedTemplate>(attachments.values())); } ``` Hope this helps!
Create a Java method that does the following: "Returns a set of all attached templates.".
Of course, here is the Java code you requested: ```java @Override public <T extends Serializable, S extends Individual<T, S>> T firstIndividual(Class<? extends S> clazz) { return this.pHelper.firstIndividual(clazz); } ``` Hope this helps!
Create a Java method that does the following: "Returns the first individual of the given class.".
Of course, here is the Java code you requested: ```java @Override public IndividualPropertyHelper withIndividual(Name<?> id, String managerId) { return this.pHelper.withIndividual(id,managerId); } ``` Hope this helps!
Create a Java method that does the following: "Override this method to add additional properties to an individual property.".
Of course, here is the Java code you requested: ```java public List<Name<String>> pendingAttachmentNames(String attachmentId) { List<Name<String>> result = new ArrayList<Name<String>>(); NameSource source = this.attachmentNameSources.get(attachmentId); if(source!=null) { result.addAll(source.pendingNames); ...
Create a Java method that does the following: "Gets the pending names of an attachment.".
Of course, here is the Java code you requested: ```java public void addAttachmentName(String attachmentId, Name<String> nextName) { nameSource(attachmentId).addName(nextName); } ``` Hope this helps!
Create a Java method that does the following: "Add an attachment name to the destination.".
Of course, here is the Java code you requested: ```java private boolean hasSameCustomParameters(final ImmutableMediaType that) { if(this.parameters.size()!=that.parameters.size()) { return false; } for(final Entry<String, String> parameter:this.parameters.entrySet()) { final String key=parameter.getKey(); ...
Create a Java method that does the following: "Checks if the given media type has the same custom parameters.".
Of course, here is the Java code you requested: ```java private static void parseSuffix(final MediaRange mr, final String mediaType) { final String subType=mr.subType; final int plusIdx=subType.lastIndexOf('+'); if(plusIdx==0) { throw new InvalidMediaTypeException(mediaType,"missing subtype for structured med...
Create a Java method that does the following: "Parses the suffix of a media type.".
Of course, here is the Java code you requested: ```java private static void checkQuotedString(final String quotedString) { boolean quotedPair=false; for(int i=0;i<quotedString.length();i++) { final char ch=quotedString.charAt(i); if(quotedPair) { checkArgument(QUOTED_PAIR.get(ch),"Invalid quoted-pair cha...
Create a Java method that does the following: "Checks that a quoted - string is valid.".
Of course, here is the Java code you requested: ```java @Override public final Status status() { Status result=Status.PUBLISHED; if(this.endpoint.deleted()!=null) { return Status.GONE; } return result; } ``` Hope this helps!
Create a Java method that does the following: "Returns the status of the endpoint.".
Of course, here is the Java code you requested: ```java @Override public void run() { ApplicationContext ctx = ApplicationContext.getInstance(); Date date = new Date(); LOGGER.debug("Starting update process on {}...",date); try(WriteSession session = ctx.createSession()) { ResourceSnapshot snapshot = sessi...
Create a Java method that does the following: "Update the resource.".
Of course, here is the Java code you requested: ```java public static RuntimeInstance getInstance() { RuntimeInstance result = RuntimeInstance.CACHED_DELEGATE.get(); if (result != null) { return result; } synchronized(RuntimeInstance.CACHED_DELEGATE) { result=RuntimeInstance.CACHED_DELEGATE.get(); if(...
Create a Java method that does the following: "Gets the delegate runtime instance.".
Of course, here is the Java code you requested: ```java static boolean isNameStartChar(final int codePoint) { return (codePoint == ':') || (codePoint >= 'A' && codePoint <= 'Z') || (codePoint == '_') || (codePoint >= 'a' && codePoint <= 'z')...
Create a Java method that does the following: "Checks if a character is a name start character.".
Of course, here is the Java code you requested: ```java static boolean isNameChar(final int codePoint) { return isNameStartChar(codePoint) || (codePoint == '-') || (codePoint == '.') || (codePoint >= '0' && codePoint <= '9') || ...
Create a Java method that does the following: "Checks if a character is a name character.".
Of course, here is the Java code you requested: ```java public static Language of(final Locale locale) { requireNonNull(locale,"Locale cannot be null"); checkArgument(locale.getVariant().isEmpty(),"Language does not allow locale variants (%s)",locale.getVariant()); return new ImmutableLanguage(locale); } ``` H...
Create a Java method that does the following: "Returns an immutable language for the given locale.".
Of course, here is the Java code you requested: ```java public static Language fromString(final String language) { requireNonNull(language,"Language cannot be null"); if(WILDCARD.equals(language)) { return wildcard(); } else { return of(parseLocale(language)); } } ``` Hope this helps!
Create a Java method that does the following: "Creates a language from a string.".
Of course, here is the Java code you requested: ```java public static boolean includes(final Language language1, final Language language2) { if(language1==null || language2==null) { return false; } if(language1.isWildcard()) { return true; } if(language2.isWildcard()) { return false; } return ...
Create a Java method that does the following: "Checks if two languages are included in the result.".
Of course, here is the Java code you requested: ```java @Override public final String encode(Name<?> name) { if(name==null) { return null; } try { Serializable target = prepare(name); byte[] serializedData=SerializationUtils.serialize(target); return BaseEncoding.base64().encode(serializedData); }...
Create a Java method that does the following: "Encodes the given name into a base64 encoded string.".
Of course, here is the Java code you requested: ```java @Override public final <T extends Serializable> Name<T> decode(String data) { if(data==null) { return null; } try { byte[] serializedData=BaseEncoding.base64().decode(data); Serializable subject=SerializationUtils.deserialize(serializedData, Seria...
Create a Java method that does the following: "Decodes the given data into a name.".
Of course, here is the Java code you requested: ```java @Override public IndividualPropertyHelper withIndividual(Name<?> id, String managerId, URI path) { return this.iph; } ``` Hope this helps!
Create a Java method that does the following: "Override this method to override the default implementation.".
Of course, here is the Java code you requested: ```java private static boolean isCorrectColonNamespaceURISplit(String namespace, String localName, char lastNsChar) { return lastNsChar == COLON && isValidColonLocalName(localName) && isValidColonNamespace(namespace); } ``` Hope this helps!
Create a Java method that does the following: "Checks if the namespace URI splits the given namespace name and local name.".
Of course, here is the Java code you requested: ```java static int getLocalNameIndex(String uri) { int separatorIdx = uri.indexOf(HASH); if (separatorIdx < 0) { separatorIdx = uri.lastIndexOf(SLASH); } if (separatorIdx < 0) { separatorIdx = uri.lastIndexOf(COLON); } if (separatorIdx < 0) { thro...
Create a Java method that does the following: "Get the local name index of the given URI.".
Of course, here is the Java code you requested: ```java static boolean isCorrectURISplit(String namespace, String localName) { assert namespace != null : "namespace must not be null"; assert localName != null : "localName must not be null"; boolean result=false; int nsLength = namespace.length(); if(nsLengt...
Create a Java method that does the following: "Checks if the namespace and localName are correct URI splits.".
Of course, here is the Java code you requested: ```java private static RuntimeDelegate findDelegate() { try { RuntimeDelegate result=createRuntimeInstanceFromSPI(); if(result==null) { result=createRuntimeInstanceFromConfigurationFile(); } if(result==null) { String delegateClassName = System.getP...
Create a Java method that does the following: "Find the runtime delegate.".
Of course, here is the Java code you requested: ```java static void checkToken(final String token, final String message, Object... args) { checkNotNull(message,"Message cannot be null"); try { validateLength(token); validateCharacters(token); } catch (IllegalArgumentException e) { throw new InvalidToken...
Create a Java method that does the following: "Check that a token is valid.".
Of course, here is the Java code you requested: ```java public static Class<?> getSubclassInScope(final Class<?> scopeClass) { final String callerClass = Thread.currentThread().getStackTrace()[3].getClassName(); try { final Class<?> candidateClass = Class.forName(callerClass, false, Thread.currentThread().getCo...
Create a Java method that does the following: "Get the subclass of the specified class in the specified scope.".
Of course, here is the Java code you requested: ```java @Override public Attachment findAttachment(ResourceId resourceId) { checkNotNull(resourceId,"Attached resource identifier cannot be null"); return this.attachments.get(this.attachmentsByResourceId.get(resourceId)); } ``` Hope this helps!
Create a Java method that does the following: "Returns the attachment with the given resource id.".
Of course, here is the Java code you requested: ```java @Override public <T extends Resource> T attach(String attachmentId, ResourceId resourceId, Class<? extends T> clazz) { checkNotNull(attachmentId,"Attachment identifier cannot be null"); checkNotNull(resourceId,"Attached resource identifier cannot be null"); ...
Create a Java method that does the following: "Attaches a new attachment to the specified resource.".
Of course, here is the Java code you requested: ```java @Override public Set<InMemoryAttachment> attachments() { return Collections.unmodifiableSet(new LinkedHashSet<InMemoryAttachment>(this.attachments.values())); } ``` Hope this helps!
Create a Java method that does the following: "Returns a set of all in - memory attachments.".
Of course, here is the Java code you requested: ```java @Override public void removeFailure(ConstraintReport report) { if(report!=null) { String failureId = report.id().failureId(); synchronized(this) { this.reports.remove(failureId); } } } ``` Hope this helps!
Create a Java method that does the following: "Removes a constraint report from the list of reports.".
Of course, here is the Java code you requested: ```java @Override public Date convertToEntityAttribute(String dbData) { if(dbData==null) { return null; } return new Date(Long.parseLong(dbData)); } ``` Hope this helps!
Create a Java method that does the following: "Convert the data from the database to a Date.".
Of course, here is the Java code you requested: ```java @Override public Endpoint endpointOfPath(String path) { this.readLock.lock(); try { return this.endpointsByPath.get(path); } finally { this.readLock.unlock(); } } ``` Hope this helps!
Create a Java method that does the following: "Returns the endpoint of the given path.".
Of course, here is the Java code you requested: ```java @Override public Endpoint endpointOfResource(ResourceId id) { this.readLock.lock(); try { Endpoint endpoint = this.endpointsByResourceName.get(id); if(endpoint!=null && endpoint.deleted()!=null) { endpoint=null; } return endpoint; } finally...
Create a Java method that does the following: "Returns the endpoint of the resource with the given id.".
Of course, here is the Java code you requested: ```java @Override public void shutdown() throws LifecycleException { this.writeLock.lock(); try { this.endpointsByPath.clear(); this.endpointsByResourceName.clear(); } finally { this.writeLock.unlock(); } } ``` Hope this helps!
Create a Java method that does the following: "Shutdown the service.".
Of course, here is the Java code you requested: ```java @Override public synchronized <S extends ResourceSnapshot> S resolve(Class<? extends S> snapshotClass, Individual<?, ?> individual) { verifyExecutability(); return this.delegate.resolve(snapshotClass,individual); } ``` Hope this helps!
Create a Java method that does the following: "Resolves a snapshot of the given class and individual.".
Of course, here is the Java code you requested: ```java @Override public synchronized <S extends ResourceSnapshot> S find(Class<? extends S> snapshotClass, Name<?> id, Class<? extends ResourceHandler> handlerClass) { verifyExecutability(); return this.delegate.find(snapshotClass,id,handlerClass); } ``` Hope thi...
Create a Java method that does the following: "Find a snapshot of the given class and id.".
Of course, here is the Java code you requested: ```java @Override public String convertToDatabaseColumn(EntityTag attribute) { if(attribute==null) { return null; } return attribute.toString(); } ``` Hope this helps!
Create a Java method that does the following: "Convert a entity tag to a database column name.".
Of course, here is the Java code you requested: ```java @Override public EntityTag convertToEntityAttribute(String dbData) { if(dbData==null) { return null; } return EntityTag.valueOf(dbData); } ``` Hope this helps!
Create a Java method that does the following: "Convert the database data to an entity attribute.".
Of course, here is the Java code you requested: ```java @Override protected Properties mergeProperties() throws IOException { Properties result = super.mergeProperties(); if(canShowConfiguration(getModuleName())) { table.setProperties(result); table.dump(System.out); // NOSONAR } return result; } ``` ...
Create a Java method that does the following: "Override mergeProperties to provide a more flexible way to set the properties.".
Of course, here is the Java code you requested: ```java static void registerAdapterClass(Class<?> clazz) { Objects.requireNonNull(clazz,"Adapter class cannot be null"); TypeAdapter.ADAPTER_CLASSES.addIfAbsent(clazz); } ``` Hope this helps!
Create a Java method that does the following: "Registers an adapter class.".
Of course, here is the Java code you requested: ```java static <S,T> TypeAdapter<S,T> createAdapter(Class<? extends S> sourceType, Class<? extends T> targetType) { return doCreateAdapter(targetType,AdapterMethodValidator.newInstance(targetType, sourceType)); } ``` Hope this helps!
Create a Java method that does the following: "Create an adapter for the given type.".
Of course, here is the Java code you requested: ```java static <S,T> T adapt(S object, Class<? extends T> resultClass) { return TypeAdapter.<S,T>doCreateAdapter(resultClass, AdapterMethodValidator.newInstance(resultClass, object)).adapt(object); } ``` Hope this helps!
Create a Java method that does the following: "Adapt a Java type into a Java type.".
Of course, here is the Java code you requested: ```java @Override public <T> T firstValue(final Class<? extends T> aClazz) { Property property=getProperty(); if(property==null) { return null; } LiteralValueExtractor<T> extractor =LiteralValueExtractor.newInstance(aClazz); for(Value value:property) { v...
Create a Java method that does the following: "Returns the first value of the property.".
Of course, here is the Java code you requested: ```java @Override public <T extends Serializable, S extends Individual<T,S>> T firstIndividual(final Class<? extends S> clazz) { Property property=getProperty(); if(property==null) { return null; } IndividualExtractor<T,S> extractor=IndividualExtractor.newIns...
Create a Java method that does the following: "Returns the first individual of this object.".
Of course, here is the Java code you requested: ```java @Override public IndividualPropertyHelper withLiteral(Object rawValue) { if(rawValue!=null) { Literal<?> value = Literals.newLiteral(rawValue); this.individual.addValue(this.propertyId,value); } return new IndividualPropertyHelperImpl(new IndividualH...
Create a Java method that does the following: "Adds a literal to the individual property.".
Of course, here is the Java code you requested: ```java @Override public IndividualPropertyHelper withIndividual(Name<?> id) { if(id!=null) { @SuppressWarnings("rawtypes") Individual<?,?> srcIndividual = this.individual.dataSet().individual((Name)id, LocalIndividual.class); this.individual.addValue(this.pr...
Create a Java method that does the following: "Add an individual to the individual property.".
Of course, here is the Java code you requested: ```java @Override public IndividualPropertyHelper withIndividual(Name<?> id, String managerId) { if(id!=null) { Individual<?,?> srcIndividual = this.individual. dataSet(). individual( ManagedIndividualId.createId(id, managerId), Managed...
Create a Java method that does the following: "Add an individual property to this property.".
Of course, here is the Java code you requested: ```java @Override public IndividualPropertyHelper withIndividual(Name<?> id, String managerId, URI path) { if(id!=null) { ManagedIndividualId parentId=ManagedIndividualId.createId(id,managerId); RelativeIndividualId individualId=RelativeIndividualId.createId(par...
Create a Java method that does the following: "Override this method to add an individual to the individual property set.".
Of course, here is the Java code you requested: ```java @Override public IndividualPropertyHelper withIndividual(Name<?> id, String managerId, String path) { if(id!=null) { return withIndividual(id, managerId, URI.create(path)); } return new IndividualPropertyHelperImpl(new IndividualHelperImpl(this.individu...
Create a Java method that does the following: "Override this method to add individual properties to the individual property.".
Of course, here is the Java code you requested: ```java @Override public Boolean fromString(final String rawValue) { try { return PrimitiveObjectFactory.parseBoolean(rawValue); } catch (final IllegalArgumentException e) { throw new ObjectParseException(e,Boolean.class, rawValue); } } ``` Hope this helps...
Create a Java method that does the following: "Convert a String to a Boolean.".
Of course, here is the Java code you requested: ```java @Override public List<String> getPrefixes(String namespaceURI) { List<String> list=new ArrayList<String>(); for(Entry<String,String> entry:this.map.entrySet()) { if(entry.getValue().equals(namespaceURI)) { list.add(entry.getKey()); } } return l...
Create a Java method that does the following: "Get the list of prefixes that are contained in the specified namespace URI.".
Of course, here is the Java code you requested: ```java @SuppressWarnings("unchecked") @Override protected <T extends Serializable> Name<T> assemble(Serializable subject) throws IOException { return (Name<T>)NamingScheme.getDefault().name(subject); } ``` Hope this helps!
Create a Java method that does the following: "Assemble a name from a serializable object.".
Of course, here is the Java code you requested: ```java public final NameProvider nameProvider(Name<?> containerName) { NameProvider result = this.nameProviders.get(containerName); if(result==null) { throw new ApplicationRuntimeException("Unknown container '"+containerName+"'"); } return result; } ``` Hop...
Create a Java method that does the following: "Returns the name provider for the given container name.".
Of course, here is the Java code you requested: ```java static boolean equalsIgnoreCase(final CharSequence str1, final CharSequence str2) { if(str1==str2) { return true; } else if(str1==null||str2==null) { return false; } else if(str1.length()!=str2.length()) { return false; } else { return regionM...
Create a Java method that does the following: "Checks if two CharSequences are equals.".
Of course, here is the Java code you requested: ```java private static void addProtocolSpecificHeaders(ResponseBuilder builder, Class<? extends PublicResource> clazz) { List<Term> types=new ArrayList<Term>(); if(PublicRDFSource.class.isAssignableFrom(clazz)) { types.add(LDP.RESOURCE); } if(PublicBasicContai...
Create a Java method that does the following: "Add protocol specific headers to response builder".
Of course, here is the Java code you requested: ```java static String getAcceptableContent( List<Variant> variants, URI resourceLocation, List<String> supportedCharsets) { StringBuilder builder = new StringBuilder(); for (Variant variant : variants) { MediaType mediaType = variant.getMediaType(); bu...
Create a Java method that does the following: "Get a string containing the acceptable content of the content of the resource.".
Of course, here is the Java code you requested: ```java public static ApplicationEngine engine() { ApplicationEngine result = ApplicationEngine.CACHED_DELEGATE.get(); if (result != null) { return result; } synchronized(ApplicationEngine.CACHED_DELEGATE) { result=ApplicationEngine.CACHED_DELEGATE.get(); ...
Create a Java method that does the following: "Returns the delegate application engine.".
Of course, here is the Java code you requested: ```java @Override public void checkType(final String type) { validateLength(type,"Type"); validateFirstChar(type,"type"); validateOtherChars(type,"type"); } ``` Hope this helps!
Create a Java method that does the following: "Check the type.".
Of course, here is the Java code you requested: ```java @Override public void checkSubType(final String subType) { validateLength(subType,"Subtype"); validateFirstChar(subType,"subtype"); validateOtherChars(subType,"subtype"); } ``` Hope this helps!
Create a Java method that does the following: "Check if the subtype is valid.".
Of course, here is the Java code you requested: ```java private void verifyInteractionModel(InteractionModel interactionModel) { if(interactionModel==null) { return; } Set<InteractionModel> acceptable=Sets.newHashSet(); containerTemplate().memberTemplate().accept(new AcceptableInteractionModelCollector(acce...
Create a Java method that does the following: "Verify that the interaction model is valid.".
Of course, here is the Java code you requested: ```java @Override public void setup(Environment environment, Bootstrap<Configuration> bootstrap) throws ApplicationSetupException { LOGGER.info("Configuring application: {}, {}",environment,bootstrap); PersonHandler resourceHandler = new PersonHandler(); PersonCon...
Create a Java method that does the following: "Setup the application.".
Of course, here is the Java code you requested: ```java @Override public void initialize(WriteSession session) throws ApplicationInitializationException { LOGGER.info("Initializing application: {}",session); ResourceSnapshot person = session.find(ResourceSnapshot.class,this.personResourceName,PersonHandler.class)...
Create a Java method that does the following: "Initializes the application.".
Of course, here is the Java code you requested: ```java @Override public void shutdown() { LOGGER.info("Shutting down application..."); this.executorService.shutdown(); boolean finished=this.executorService.isTerminated(); while(!finished) { try { this.executorService.awaitTermination(100, TimeUnit.MIL...
Create a Java method that does the following: "Shuts down the application.".
Of course, here is the Java code you requested: ```java public Path withFile(final String file) { final Path result = new Path(this); result.setFile(file); return result; } ``` Hope this helps!
Create a Java method that does the following: "Creates a new Path with the specified file.".
Of course, here is the Java code you requested: ```java public Path relativize(final Path path) { Objects.requireNonNull("Path cannot be null"); final Path base=this; // By default, we return the normalized form of the input path final Path defaultRelative = path.normalize(); // Either root or not if(ba...
Create a Java method that does the following: "Returns the relative path of this path to the given path.".
Of course, here is the Java code you requested: ```java @Override public IndividualHelper managedIndividual(final Name<?> name, final String managerId) { final ManagedIndividualId individualId = ManagedIndividualId.createId(name,managerId); final ManagedIndividual individual = this.dataSet.individual(individualId...
Create a Java method that does the following: "Create an individual helper.".
Of course, here is the Java code you requested: ```java @Override public IndividualHelper localIndividual(final Name<?> name) { @SuppressWarnings("rawtypes") final LocalIndividual individual = this.dataSet.individual((Name)name, LocalIndividual.class); return new IndividualHelperImpl(individual); } ``` Hope...
Create a Java method that does the following: "Gets the individual for the given name.".
Of course, here is the Java code you requested: ```java @Override public IndividualHelper externalIndividual(final URI uri) { Individual<?, ?> individual=null; if(uri.isAbsolute()) { individual=this.dataSet.individual(uri, ExternalIndividual.class); } else { individual=this.dataSet.individual(uri, NewIndi...
Create a Java method that does the following: "Returns an individual helper for an external individual.".
Of course, here is the Java code you requested: ```java @Override @SuppressWarnings("unchecked") public T fromString(final String rawValue) { // NOSONAR try { Object result = null; if (byte.class.equals(this.valueClass)) { result = Byte.decode(rawValue); } else if (short.class.equals(this.valueClass))...
Create a Java method that does the following: "Converts the given raw value to the appropriate value class.".
Of course, here is the Java code you requested: ```java public static <T> PrimitiveObjectFactory<T> create(final Class<? extends T> valueClass) { checkNotNull(valueClass, "Value class cannot be null"); checkArgument(valueClass.isPrimitive(), "Value class '" + valueClass.getName() + "' is not primitive"); return ...
Create a Java method that does the following: "Create a primitive object factory.".
Of course, here is the Java code you requested: ```java @SuppressWarnings("unchecked") public Individual<T,S> resolve(DataSet dataSet) { return (Individual<T,S>) dataSet.individualOfId(ref()); } ``` Hope this helps!
Create a Java method that does the following: "Resolves this individual to a data set.".
Of course, here is the Java code you requested: ```java @SuppressWarnings("unchecked") public final <T extends Activity> T waitForActivity( Class<T> activityClass, long timeout, TimeUnit timeUnit) { long timeoutInMs = timeUnit.toMillis(timeout); Activity mostRecentlyStartedActivity = g...
Create a Java method that does the following: "Wait for an activity of the specified class.".
Of course, here is the Java code you requested: ```java @Factory public static <T extends ViewGroup> Matcher<T> equalChildrenCountAs(int value) { return new ViewGroupComparison<T>(value, EQUAL, EQUAL); } ``` Hope this helps!
Create a Java method that does the following: "Creates a matcher that matches views whose children count is equal to the given value.".
Of course, here is the Java code you requested: ```java @Factory public static <T extends ViewGroup> Matcher<T> moreChildrenOrEqual(int value) { return new ViewGroupComparison<T>(value, EQUAL, GREATER_THAN); } ``` Hope this helps!
Create a Java method that does the following: "Creates a Matcher that matches views that have more children than or equal to the given value.".
Of course, here is the Java code you requested: ```java @Factory public static <T extends ViewGroup> Matcher<T> lessChildrenThan(int value) { return new ViewGroupComparison<T>(value, LESS_THAN, LESS_THAN); } ``` Hope this helps!
Create a Java method that does the following: "Creates a Matcher that matches views that are less than the specified value.".
Of course, here is the Java code you requested: ```java public Categories getCategories(String stateId) throws VoteSmartException, VoteSmartErrorException { return api.query("Rating.getCategories", new ArgMap("stateId", stateId), Categories.class ); } ``` Hope this helps!
Create a Java method that does the following: "Get the categories for a rating state.".
Of course, here is the Java code you requested: ```java public Sigs getSigList(String categoryId) throws VoteSmartException, VoteSmartErrorException { return api.query("Rating.getSigList", new ArgMap("categoryId", categoryId), Sigs.class ); } ``` Hope this helps!
Create a Java method that does the following: "Get the list of sigs for a given category.".
Of course, here is the Java code you requested: ```java public CandidateRating getCandidateRating(String candidateId) throws VoteSmartException, VoteSmartErrorException { return api.query("Rating.getCandidateRating", new ArgMap("candidateId", candidateId), CandidateRating.class ); } ``` Hope this helps!
Create a Java method that does the following: "Get the rating for a candidate.".
Of course, here is the Java code you requested: ```java public Rating getRating(String ratingId) throws VoteSmartException, VoteSmartErrorException { return api.query("Rating.getRating", new ArgMap("ratingId", ratingId), Rating.class ); } ``` Hope this helps!
Create a Java method that does the following: "Get a rating.".
Of course, here is the Java code you requested: ```java public Elections getElectionByYearState(String year) throws VoteSmartException, VoteSmartErrorException { return api.query("Election.getElectionByYearState", new ArgMap("year", year), Elections.class ); } ``` Hope this helps!
Create a Java method that does the following: "Get a list of elections for a given year.".
Of course, here is the Java code you requested: ```java public ElectionByZip getElectionByZip(String zip5) throws VoteSmartException, VoteSmartErrorException { return api.query("Election.getElectionByZip", new ArgMap("zip5", zip5), ElectionByZip.class ); } ``` Hope this helps!
Create a Java method that does the following: "Get a list of elections by zip".
Of course, here is the Java code you requested: ```java public AddressAddress getOfficeByOfficeState(String officeId) throws VoteSmartException, VoteSmartErrorException { return api.query("Address.getOfficeByOfficeState", new ArgMap("officeId", officeId), AddressAddress.class ); } ``` Hope this helps!
Create a Java method that does the following: "Get an address by office id".
Of course, here is the Java code you requested: ```java public DistrictList getByOfficeState( String officeId, String stateId) throws VoteSmartException, VoteSmartErrorException { return api.query("District.getByOfficeState", new ArgMap("officeId", officeId, "stateId", stateId), DistrictList.class ); } ``` Hope ...
Create a Java method that does the following: "Get a list of districts by office id and state id.".
Of course, here is the Java code you requested: ```java public Offices getOfficesByType(String officeTypeId) throws VoteSmartException, VoteSmartErrorException { return api.query("Office.getOfficesByType", new ArgMap("officeTypeId", officeTypeId), Offices.class ); } ``` Hope this helps!
Create a Java method that does the following: "Get all offices by type id".
Of course, here is the Java code you requested: ```java public Offices getOfficesByLevel(String levelId) throws VoteSmartException, VoteSmartErrorException { return api.query("Office.getOfficesByLevel", new ArgMap("levelId", levelId), Offices.class ); } ``` Hope this helps!
Create a Java method that does the following: "Get all offices for a given level".
Of course, here is the Java code you requested: ```java public Offices getOfficesByBranchLevel(String branchId, String levelId) throws VoteSmartException, VoteSmartErrorException { return api.query("Office.getOfficesByBranchLevel", new ArgMap("branchId", branchId, "levelId", levelId), Offices.class ); } ``` Hope...
Create a Java method that does the following: "Get all offices for a branch.".
Of course, here is the Java code you requested: ```java public Counties getCounties(String stateId) throws VoteSmartException, VoteSmartErrorException { return api.query("Local.getCounties", new ArgMap("stateId", stateId), Counties.class ); } ``` Hope this helps!
Create a Java method that does the following: "Get the counties for a given state.".
Of course, here is the Java code you requested: ```java public Cities getCities(String stateId) throws VoteSmartException, VoteSmartErrorException { return api.query("Local.getCities", new ArgMap("stateId", stateId), Cities.class ); } ``` Hope this helps!
Create a Java method that does the following: "Get the cities for a given state.".
Of course, here is the Java code you requested: ```java public LocalCandidateList getOfficials(String localId) throws VoteSmartException, VoteSmartErrorException { return api.query("Local.getOfficials", new ArgMap("localId", localId), LocalCandidateList.class ); } ``` Hope this helps!
Create a Java method that does the following: "Get all officials of a local.".
Of course, here is the Java code you requested: ```java public <T> T query(String method, ArgMap argMap, Class<T> responseType) throws VoteSmartException, VoteSmartErrorException { BufferedReader reader = null; HttpURLConnection conn = null; String charSet = "utf-8"; try { if ( isCaching(method, argMap) ) {...
Create a Java method that does the following: "Query for a single object from the server.".
Of course, here is the Java code you requested: ```java public CandidateList getByOfficeTypeState(String officeTypeId, String stateId) throws VoteSmartException, VoteSmartErrorException { return api.query("Officials.getByOfficeTypeState", new ArgMap("officeTypeId", officeTypeId, "stateId", stateId), CandidateList.c...
Create a Java method that does the following: "Get a CandidateList by office type and state id".
Of course, here is the Java code you requested: ```java public CandidateList getByZip(String zip5) throws VoteSmartException, VoteSmartErrorException { return api.query("Officials.getByZip", new ArgMap("zip5", zip5), CandidateList.class ); } ``` Hope this helps!
Create a Java method that does the following: "Get a list of candidate objects in the specified zip.".
Of course, here is the Java code you requested: ```java public CandidateList getByLastname(String lastName, String electionYear) throws VoteSmartException, VoteSmartErrorException { return api.query("Candidates.getByLastname", new ArgMap("lastName", lastName, "electionYear", electionYear), CandidateList.class ); ...
Create a Java method that does the following: "Get a candidate list by lastname and election year.".
Of course, here is the Java code you requested: ```java public Committees getCommitteesByTypeState(String typeId) throws VoteSmartException, VoteSmartErrorException { return api.query("Committee.getCommitteesByTypeState", new ArgMap("typeId", typeId), Committees.class ); } ``` Hope this helps!
Create a Java method that does the following: "Get a list of committees by type state.".
Of course, here is the Java code you requested: ```java public Leadership getPositions(String stateId) throws VoteSmartException, VoteSmartErrorException { return api.query("Leadership.getPositions", new ArgMap("stateId", stateId), Leadership.class ); } ``` Hope this helps!
Create a Java method that does the following: "Get the positions of a leadership.".
Of course, here is the Java code you requested: ```java public VotesCategories getCategories(String year) throws VoteSmartException, VoteSmartErrorException { return api.query("Votes.getCategories", new ArgMap("year", year), VotesCategories.class ); } ``` Hope this helps!
Create a Java method that does the following: "Get the categories for a given year.".
Of course, here is the Java code you requested: ```java public BillAction getBillAction(String actionId) throws VoteSmartException, VoteSmartErrorException { return api.query("Votes.getBillAction", new ArgMap("actionId", actionId), BillAction.class ); } ``` Hope this helps!
Create a Java method that does the following: "Get a bill action.".
Of course, here is the Java code you requested: ```java public BillActionVotes getBillActionVotes(String actionId) throws VoteSmartException, VoteSmartErrorException { return api.query("Votes.getBillActionVotes", new ArgMap("actionId", actionId), BillActionVotes.class ); } ``` Hope this helps!
Create a Java method that does the following: "Get BillActionVotes for the given actionId.".
Of course, here is the Java code you requested: ```java public BillActionVotes getBillActionVoteByOfficial(String actionId, String candidateId) throws VoteSmartException, VoteSmartErrorException { return api.query("Votes.getBillActionVoteByOfficial", new ArgMap("actionId", actionId, "candidateId", candidateId), Bil...
Create a Java method that does the following: "Get BillActionVotes for an official bill action.".