当前位置: 首页>>代码示例>>Java>>正文


Java FieldAccess类代码示例

本文整理汇总了Java中com.esotericsoftware.reflectasm.FieldAccess的典型用法代码示例。如果您正苦于以下问题:Java FieldAccess类的具体用法?Java FieldAccess怎么用?Java FieldAccess使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FieldAccess类属于com.esotericsoftware.reflectasm包,在下文中一共展示了FieldAccess类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: UnionTypeAdapter

import com.esotericsoftware.reflectasm.FieldAccess; //导入依赖的package包/类
private UnionTypeAdapter(
    final Class unionClass,
    final TypeAdapter<?> discriminatorTypeAdapter,
    final FieldAccess fieldAccess,
    final Map<String, UnionMemberInfo> memberInfoMap
) {
  this.unionClass = unionClass;
  this.discriminatorTypeAdapter = discriminatorTypeAdapter;
  this.fieldAccess = fieldAccess;
  this.memberInfoMap = memberInfoMap;
}
 
开发者ID:aguther,项目名称:dds-examples,代码行数:12,代码来源:UnionTypeAdapterFactory.java

示例2: getFieldAccess

import com.esotericsoftware.reflectasm.FieldAccess; //导入依赖的package包/类
private FieldAccess getFieldAccess(String fieldName) {
    FieldAccess fieldAccess = clsFieldPool.get(cls);

    if (fieldAccess == null) {
        fieldAccess = FieldAccess.get(cls);
        clsFieldPool.put(cls, fieldAccess);
    }

    return fieldAccess;
}
 
开发者ID:landawn,项目名称:AbacusUtil,代码行数:11,代码来源:ReflectASM.java

示例3: createCachedFields

import com.esotericsoftware.reflectasm.FieldAccess; //导入依赖的package包/类
private void createCachedFields (IntArray useAsm, List<Field> validFields, List<CachedField> cachedFields, int baseIndex) {

		if (useAsmEnabled || !useMemRegions) {
			for (int i = 0, n = validFields.size(); i < n; i++) {
				Field field = validFields.get(i);
				int accessIndex = -1;
				if (access != null && useAsm.get(baseIndex + i) == 1) accessIndex = ((FieldAccess)access).getIndex(field.getName());
				cachedFields.add(newCachedField(field, cachedFields.size(), accessIndex));
			}
		} else {
			unsafeUtil.createUnsafeCacheFieldsAndRegions(validFields, cachedFields, baseIndex, useAsm);
		}
	}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:14,代码来源:FieldSerializer.java

示例4: newCachedField

import com.esotericsoftware.reflectasm.FieldAccess; //导入依赖的package包/类
CachedField newCachedField (Field field, int fieldIndex, int accessIndex) {
	Class[] fieldClass = new Class[] {field.getType()};
	Type fieldGenericType = field.getGenericType();
	CachedField cachedField;

	if (fieldGenericType == fieldClass[0]) {
		// This is a field without generic type parameters
		if (TRACE) trace("kryo", "Field " + field.getName() + ": " + fieldClass[0]);
		cachedField = newMatchingCachedField(field, accessIndex, fieldClass[0], fieldGenericType, null);
	} else {
		cachedField = genericsUtil.newCachedFieldOfGenericType(field, accessIndex, fieldClass, fieldGenericType);
	}

	if (cachedField instanceof ObjectField) {
		hasObjectFields = true;
	}

	cachedField.field = field;
	cachedField.varIntsEnabled = varIntsEnabled;

	if (!useAsmEnabled) {
		cachedField.offset = unsafeUtil.getObjectFieldOffset(field);
	}

	cachedField.access = (FieldAccess)access;
	cachedField.accessIndex = accessIndex;
	cachedField.canBeNull = fieldsCanBeNull && !fieldClass[0].isPrimitive() && !field.isAnnotationPresent(NotNull.class);

	// Always use the same serializer for this field if the field's class is final.
	if (kryo.isFinal(fieldClass[0]) || fixedFieldTypes) cachedField.valueClass = fieldClass[0];

	return cachedField;
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:34,代码来源:FieldSerializer.java

示例5: createCachedFields

import com.esotericsoftware.reflectasm.FieldAccess; //导入依赖的package包/类
private void createCachedFields (IntArray useAsm, List<Field> validFields, List<CachedField> cachedFields,
	int baseIndex) {
	
	if (useAsmEnabled || !useMemRegions) {
		for (int i = 0, n = validFields.size(); i < n; i++) {
			Field field = validFields.get(i);
			int accessIndex = -1;
			if (access != null && useAsm.get(baseIndex + i) == 1) accessIndex = ((FieldAccess)access).getIndex(field.getName());
			cachedFields.add(newCachedField(field, cachedFields.size(), accessIndex));
		}
	} else {
		unsafeUtil.createUnsafeCacheFieldsAndRegions(validFields, cachedFields, baseIndex, useAsm);
	}
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:15,代码来源:FieldSerializer.java

示例6: newCachedField

import com.esotericsoftware.reflectasm.FieldAccess; //导入依赖的package包/类
CachedField newCachedField (Field field, int fieldIndex, int accessIndex) {
	Class[] fieldClass = new Class[] { field.getType() };
	Type fieldGenericType = field.getGenericType();
	CachedField cachedField;
	
	if (fieldGenericType == fieldClass[0]) {
		// This is a field without generic type parameters
		if (TRACE) {
				trace("kryo", "Field '" + field.getName() + "' of type " + fieldClass[0]);
		}
		cachedField = newMatchingCachedField(field, accessIndex, fieldClass[0], fieldGenericType, null);
	} else {
		cachedField = genericsUtil.newCachedFieldOfGenericType(field, accessIndex, fieldClass, fieldGenericType);
	}
	
	if (cachedField instanceof ObjectField) {
		hasObjectFields = true;
	}

	cachedField.field = field;
	cachedField.varIntsEnabled = varIntsEnabled;

	if (!useAsmEnabled) {
		cachedField.offset = unsafeUtil.getObjectFieldOffset(field);
	}

	cachedField.access = (FieldAccess)access;
	cachedField.accessIndex = accessIndex;
	cachedField.canBeNull = fieldsCanBeNull && !fieldClass[0].isPrimitive() && !field.isAnnotationPresent(NotNull.class);

	// Always use the same serializer for this field if the field's class is final.
	if (kryo.isFinal(fieldClass[0]) || fixedFieldTypes) cachedField.valueClass = fieldClass[0];

	return cachedField;
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:36,代码来源:FieldSerializer.java

示例7: PacketImpl

import com.esotericsoftware.reflectasm.FieldAccess; //导入依赖的package包/类
/**
 * Constructs a new packet wrapper with the data provided
 *
 * @param data the data
 */
private PacketImpl(PacketData data) {
    this.packet = TridentServer
            .instance()
            .protocol()
            .getPacket(data.getId(), Protocol.ClientStage.PLAY, PacketDirection.IN);
    this.access = FieldAccess.get(packet.getClass());
    this.packet.decode(data.getData());

    data.getData().resetReaderIndex();
}
 
开发者ID:AgentTroll,项目名称:TridentCommons,代码行数:16,代码来源:PacketImpl.java

示例8: setClass

import com.esotericsoftware.reflectasm.FieldAccess; //导入依赖的package包/类
@Override
public void setClass(Class<?> clazz) {
    super.setClass(clazz);

    // Setup ReflectASM stuff
    try {
        access = FieldAccess.get(clazz);
        index = access.getIndex(name);
    } catch(Exception ex) {
        MyTown.instance.LOG.debug(name + " - Falling back to reflection based field caller", ex);
        index = -1;
    }
}
 
开发者ID:MyEssentials,项目名称:MyTown2,代码行数:14,代码来源:ASMCallerField.java

示例9: load

import com.esotericsoftware.reflectasm.FieldAccess; //导入依赖的package包/类
@Override public FieldAccess load(Class beanClass) {
    return FieldAccess.get(beanClass);
}
 
开发者ID:bingoohuang,项目名称:excel2javabeans,代码行数:4,代码来源:ReflectAsms.java

示例10: getFieldAccess

import com.esotericsoftware.reflectasm.FieldAccess; //导入依赖的package包/类
public static FieldAccess getFieldAccess(Class<?> beanClass) {
    return fieldAccessCache.getUnchecked(beanClass);
}
 
开发者ID:bingoohuang,项目名称:excel2javabeans,代码行数:4,代码来源:ReflectAsms.java

示例11: get

import com.esotericsoftware.reflectasm.FieldAccess; //导入依赖的package包/类
public <V> V get(String fieldName) {
    final FieldAccess fieldAccess = getFieldAccess(fieldName);

    return (V) fieldAccess.get(target, fieldName);
}
 
开发者ID:landawn,项目名称:AbacusUtil,代码行数:6,代码来源:ReflectASM.java

示例12: getField

import com.esotericsoftware.reflectasm.FieldAccess; //导入依赖的package包/类
public Object getField (Object object) throws IllegalArgumentException, IllegalAccessException {
	if (accessIndex != -1) return ((FieldAccess)access).get(object, accessIndex);
	throw new KryoException("Unknown acess index");
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:5,代码来源:AsmCacheFields.java

示例13: setField

import com.esotericsoftware.reflectasm.FieldAccess; //导入依赖的package包/类
public void setField (Object object, Object value) throws IllegalArgumentException, IllegalAccessException {
	if (accessIndex != -1)
		((FieldAccess)access).set(object, accessIndex, value);
	else
		throw new KryoException("Unknown acess index");
}
 
开发者ID:HoratiusTang,项目名称:EsperDist,代码行数:7,代码来源:AsmCacheFields.java

示例14: buildFieldCache

import com.esotericsoftware.reflectasm.FieldAccess; //导入依赖的package包/类
/**
 * Builds the field sorted cache. Sorts the fields alphabetically by name.
 */
private static void buildFieldCache(Class<?> clazz, FieldAccess fieldAccess) {

    if(!_fieldSortCache.contains(clazz)) {
        LogCache[] sortedLogCache = new LogCache[fieldAccess.getFieldCount()];

        String[] sortedFieldNames = Arrays.copyOf(fieldAccess.getFieldNames(), sortedLogCache.length);

        Arrays.sort(sortedFieldNames);

        for(int i = 0; i < sortedLogCache.length; i++) {
            sortedLogCache[i] = new LogCache(fieldAccess.getIndex(sortedFieldNames[i]),
                                             getLoggingScope(clazz, sortedFieldNames[i]));
        }

        _fieldSortCache.put(clazz, sortedLogCache);
    }

}
 
开发者ID:godaddy,项目名称:godaddy-logger,代码行数:22,代码来源:CacheableAccessors.java

示例15: getFieldIndexes

import com.esotericsoftware.reflectasm.FieldAccess; //导入依赖的package包/类
public static LogCache[] getFieldIndexes(Class<?> clazz, FieldAccess fieldAccess) {
    buildFieldCache(clazz, fieldAccess);

    return _fieldSortCache.get(clazz);
}
 
开发者ID:godaddy,项目名称:godaddy-logger,代码行数:6,代码来源:CacheableAccessors.java


注:本文中的com.esotericsoftware.reflectasm.FieldAccess类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。