Tabnine Logo
AttributeImpl.reflectWith
Code IndexAdd Tabnine to your IDE (free)

How to use
reflectWith
method
in
org.apache.lucene.util.AttributeImpl

Best Java code snippets using org.apache.lucene.util.AttributeImpl.reflectWith (Showing top 10 results out of 315)

origin: org.apache.lucene/lucene-core

/**
 * This method is for introspection of attributes, it should simply
 * add the key/values this AttributeSource holds to the given {@link AttributeReflector}.
 *
 * <p>This method iterates over all Attribute implementations and calls the
 * corresponding {@link AttributeImpl#reflectWith} method.</p>
 *
 * @see AttributeImpl#reflectWith
 */
public final void reflectWith(AttributeReflector reflector) {
 for (State state = getCurrentState(); state != null; state = state.next) {
  state.attribute.reflectWith(reflector);
 }
}
origin: org.apache.lucene/lucene-core

/**
 * This method returns the current attribute values as a string in the following format
 * by calling the {@link #reflectWith(AttributeReflector)} method:
 * 
 * <ul>
 * <li><em>iff {@code prependAttClass=true}:</em> {@code "AttributeClass#key=value,AttributeClass#key=value"}
 * <li><em>iff {@code prependAttClass=false}:</em> {@code "key=value,key=value"}
 * </ul>
 *
 * @see #reflectWith(AttributeReflector)
 */
public final String reflectAsString(final boolean prependAttClass) {
 final StringBuilder buffer = new StringBuilder();
 reflectWith((attClass, key, value) -> {
  if (buffer.length() > 0) {
   buffer.append(',');
  }
  if (prependAttClass) {
   buffer.append(attClass.getName()).append('#');
  }
  buffer.append(key).append('=').append((value == null) ? "null" : value);
 });
 return buffer.toString();
}

origin: org.infinispan/infinispan-embedded-query

/**
 * This method returns the current attribute values as a string in the following format
 * by calling the {@link #reflectWith(AttributeReflector)} method:
 * 
 * <ul>
 * <li><em>iff {@code prependAttClass=true}:</em> {@code "AttributeClass#key=value,AttributeClass#key=value"}
 * <li><em>iff {@code prependAttClass=false}:</em> {@code "key=value,key=value"}
 * </ul>
 *
 * @see #reflectWith(AttributeReflector)
 */
public final String reflectAsString(final boolean prependAttClass) {
 final StringBuilder buffer = new StringBuilder();
 reflectWith(new AttributeReflector() {
  @Override
  public void reflect(Class<? extends Attribute> attClass, String key, Object value) {
   if (buffer.length() > 0) {
    buffer.append(',');
   }
   if (prependAttClass) {
    buffer.append(attClass.getName()).append('#');
   }
   buffer.append(key).append('=').append((value == null) ? "null" : value);
  }
 });
 return buffer.toString();
}

origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

/**
 * This method is for introspection of attributes, it should simply
 * add the key/values this AttributeSource holds to the given {@link AttributeReflector}.
 *
 * <p>This method iterates over all Attribute implementations and calls the
 * corresponding {@link AttributeImpl#reflectWith} method.</p>
 *
 * @see AttributeImpl#reflectWith
 */
public final void reflectWith(AttributeReflector reflector) {
 for (State state = getCurrentState(); state != null; state = state.next) {
  state.attribute.reflectWith(reflector);
 }
}
origin: org.infinispan/infinispan-embedded-query

/**
 * This method is for introspection of attributes, it should simply
 * add the key/values this AttributeSource holds to the given {@link AttributeReflector}.
 *
 * <p>This method iterates over all Attribute implementations and calls the
 * corresponding {@link AttributeImpl#reflectWith} method.</p>
 *
 * @see AttributeImpl#reflectWith
 */
public final void reflectWith(AttributeReflector reflector) {
 for (State state = getCurrentState(); state != null; state = state.next) {
  state.attribute.reflectWith(reflector);
 }
}
origin: gncloud/fastcatsearch

/**
 * This method returns the current attribute values as a string in the following format
 * by calling the {@link #reflectWith(AttributeReflector)} method:
 * 
 * <ul>
 * <li><em>iff {@code prependAttClass=true}:</em> {@code "AttributeClass#key=value,AttributeClass#key=value"}
 * <li><em>iff {@code prependAttClass=false}:</em> {@code "key=value,key=value"}
 * </ul>
 *
 * @see #reflectWith(AttributeReflector)
 */
public final String reflectAsString(final boolean prependAttClass) {
 final StringBuilder buffer = new StringBuilder();
 reflectWith(new AttributeReflector() {
  @Override
  public void reflect(Class<? extends Attribute> attClass, String key, Object value) {
   if (buffer.length() > 0) {
    buffer.append(',');
   }
   if (prependAttClass) {
    buffer.append(attClass.getName()).append('#');
   }
   buffer.append(key).append('=').append((value == null) ? "null" : value);
  }
 });
 return buffer.toString();
}

origin: harbby/presto-connectors

/**
 * This method returns the current attribute values as a string in the following format
 * by calling the {@link #reflectWith(AttributeReflector)} method:
 * 
 * <ul>
 * <li><em>iff {@code prependAttClass=true}:</em> {@code "AttributeClass#key=value,AttributeClass#key=value"}
 * <li><em>iff {@code prependAttClass=false}:</em> {@code "key=value,key=value"}
 * </ul>
 *
 * @see #reflectWith(AttributeReflector)
 */
public final String reflectAsString(final boolean prependAttClass) {
 final StringBuilder buffer = new StringBuilder();
 reflectWith(new AttributeReflector() {
  @Override
  public void reflect(Class<? extends Attribute> attClass, String key, Object value) {
   if (buffer.length() > 0) {
    buffer.append(',');
   }
   if (prependAttClass) {
    buffer.append(attClass.getName()).append('#');
   }
   buffer.append(key).append('=').append((value == null) ? "null" : value);
  }
 });
 return buffer.toString();
}

origin: harbby/presto-connectors

/**
 * This method is for introspection of attributes, it should simply
 * add the key/values this AttributeSource holds to the given {@link AttributeReflector}.
 *
 * <p>This method iterates over all Attribute implementations and calls the
 * corresponding {@link AttributeImpl#reflectWith} method.</p>
 *
 * @see AttributeImpl#reflectWith
 */
public final void reflectWith(AttributeReflector reflector) {
 for (State state = getCurrentState(); state != null; state = state.next) {
  state.attribute.reflectWith(reflector);
 }
}
origin: gncloud/fastcatsearch

/**
 * This method is for introspection of attributes, it should simply
 * add the key/values this AttributeSource holds to the given {@link AttributeReflector}.
 *
 * <p>This method iterates over all Attribute implementations and calls the
 * corresponding {@link AttributeImpl#reflectWith} method.</p>
 *
 * @see AttributeImpl#reflectWith
 */
public final void reflectWith(AttributeReflector reflector) {
 for (State state = getCurrentState(); state != null; state = state.next) {
  state.attribute.reflectWith(reflector);
 }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

/**
 * This method returns the current attribute values as a string in the following format
 * by calling the {@link #reflectWith(AttributeReflector)} method:
 * 
 * <ul>
 * <li><em>iff {@code prependAttClass=true}:</em> {@code "AttributeClass#key=value,AttributeClass#key=value"}
 * <li><em>iff {@code prependAttClass=false}:</em> {@code "key=value,key=value"}
 * </ul>
 *
 * @see #reflectWith(AttributeReflector)
 */
public final String reflectAsString(final boolean prependAttClass) {
 final StringBuilder buffer = new StringBuilder();
 reflectWith((attClass, key, value) -> {
  if (buffer.length() > 0) {
   buffer.append(',');
  }
  if (prependAttClass) {
   buffer.append(attClass.getName()).append('#');
  }
  buffer.append(key).append('=').append((value == null) ? "null" : value);
 });
 return buffer.toString();
}

org.apache.lucene.utilAttributeImplreflectWith

Javadoc

This method is for introspection of attributes, it should simply add the key/values this attribute holds to the given AttributeReflector.

The default implementation calls AttributeReflector#reflect for all non-static fields from the implementing class, using the field name as key and the field value as value. The Attribute class is also determined by reflection. Please note that the default implementation can only handle single-Attribute implementations.

Custom implementations look like this (e.g. for a combined attribute implementation):

 
public void reflectWith(AttributeReflector reflector) { 
reflector.reflect(CharTermAttribute.class, "term", term()); 
reflector.reflect(PositionIncrementAttribute.class, "positionIncrement", getPositionIncrement()); 
} 

If you implement this method, make sure that for each invocation, the same set of Attributeinterfaces and keys are passed to AttributeReflector#reflect in the same order, but possibly different values. So don't automatically exclude e.g. null properties!

Popular methods of AttributeImpl

  • clear
    Clears the values in this AttributeImpl and resets it to its default value. If this implementation i
  • clone
    In most cases the clone is, and should be, deep in order to be able to properly capture the state of
  • copyTo
    Copies the values from this Attribute into the passed-in target attribute. The target implementation
  • end
    Clears the values in this AttributeImpl and resets it to its value at the end of the field. If this

Popular in Java

  • Parsing JSON documents to java classes using gson
  • runOnUiThread (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • setRequestProperty (URLConnection)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now