本文整理汇总了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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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;
}
示例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();
}
示例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;
}
}
示例9: load
import com.esotericsoftware.reflectasm.FieldAccess; //导入依赖的package包/类
@Override public FieldAccess load(Class beanClass) {
return FieldAccess.get(beanClass);
}
示例10: getFieldAccess
import com.esotericsoftware.reflectasm.FieldAccess; //导入依赖的package包/类
public static FieldAccess getFieldAccess(Class<?> beanClass) {
return fieldAccessCache.getUnchecked(beanClass);
}
示例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);
}
示例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");
}
示例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");
}
示例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);
}
}
示例15: getFieldIndexes
import com.esotericsoftware.reflectasm.FieldAccess; //导入依赖的package包/类
public static LogCache[] getFieldIndexes(Class<?> clazz, FieldAccess fieldAccess) {
buildFieldCache(clazz, fieldAccess);
return _fieldSortCache.get(clazz);
}