Package com.comphenix.protocol.reflect.accessors

Examples of com.comphenix.protocol.reflect.accessors.ReadOnlyFieldAccessor


   * @param accessor - the accessor.
   * @param noEntryTransform - transform the no entry value, or NULL to ignore.
   * @return The read only accessor.
   */
  public static ReadOnlyFieldAccessor wrapMapField(final FieldAccessor accessor, final Function<Integer, Integer> noEntryTransform) {
    return new ReadOnlyFieldAccessor() {
      public Object get(Object instance) {
        Object troveMap = accessor.get(instance);
       
        // Apply transform as well
        if (noEntryTransform != null)
View Full Code Here


   * Retrieve a read-only field accessor that automatically wraps the underlying Trove instance.
   * @param accessor - the accessor.
   * @return The read only accessor.
   */
  public static ReadOnlyFieldAccessor wrapSetField(final FieldAccessor accessor) {
    return new ReadOnlyFieldAccessor() {
      public Object get(Object instance) {
        return getDecoratedSet(accessor.get(instance));
      }
      public Field getField() {
        return accessor.getField();
View Full Code Here

   * Retrieve a read-only field accessor that automatically wraps the underlying Trove instance.
   * @param accessor - the accessor.
   * @return The read only accessor.
   */
  public static ReadOnlyFieldAccessor wrapListField(final FieldAccessor accessor) {
    return new ReadOnlyFieldAccessor() {
      public Object get(Object instance) {
        return getDecoratedList(accessor.get(instance));
      }
      public Field getField() {
        return accessor.getField();
View Full Code Here

    for (Field lookup : fuzzy.getFields()) {
      final Class<?> type = lookup.getType();
     
      if (TroveWrapper.isTroveClass(type)) {
        // Create a wrapper accessor
        final ReadOnlyFieldAccessor accessor = TroveWrapper.wrapMapField(
          Accessors.getFieldAccessor(lookup, true), new Function<Integer, Integer>() {
          @Override
          public Integer apply(@Nullable Integer value) {
            // Do not use zero for no entry value
            if (value == 0)
View Full Code Here

TOP

Related Classes of com.comphenix.protocol.reflect.accessors.ReadOnlyFieldAccessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.