public byte getReflectB() throws Exception { return f_b.getByte(t); }
public final int getByteValue(Object obj) throws IllegalAccessException { if (!isAndroid && memOffset >= 0) { return FSTUtil.unFlaggedUnsafe.getByte(obj, memOffset); } return field.getByte(obj); }
/** * Gets the value of a static <code>byte</code> field. * * @param field Field object whose value is returned. * @return the value of the <code>byte</code> field */ public static byte getByte(Field field) { checkStatic(field); try { return field.getByte(null); } catch (Exception exp) { throw translate(exp); } }
/** * Gets the value of an instance <code>byte</code> field. * * @param field Field object whose value is returned. * @param obj the object to extract the <code>byte</code> value * from * @return the value of the <code>byte</code> field */ public static byte getByte(Field field, Object obj) { try { return field.getByte(obj); } catch (Exception exp) { throw translate(exp); } }
public byte getByte(Object o) throws IllegalArgumentException, IllegalAccessException { return this.field.getByte(o); }
public final int getByteValue(Object obj) throws IllegalAccessException { if (!isAndroid && memOffset >= 0) { return FSTUtil.unFlaggedUnsafe.getByte(obj, memOffset); } return field.getByte(obj); }
private short getShort(Object object, Class<?> fieldType, Class<?> expectedType) { if (fieldType == Short.TYPE) { return getS(object, field); } return getByte(object, fieldType, expectedType); }
public static byte callSetByte(Field thiz, Object obj) throws IllegalArgumentException, IllegalAccessException { thiz.setByte(obj, (byte) 123); return thiz.getByte(obj); }
rep.append(joiner).append(name).append('=').append(val); } else if (type.equals(byte.class)) { byte val = ff.getByte(this); rep.append(joiner).append(name).append('=').append(val); } else if (type.equals(char.class)) {
return Byte.valueOf( field.getByte( owner ) );
/** * Returns the value of the field in the specified object as a {@code byte}. * This reproduces the effect of {@code object.fieldName} * <p> * If this field is static, the object argument is ignored. * Otherwise, if the object is {@code null}, a NullPointerException is * thrown. If the object is not an instance of the declaring class of the * method, an IllegalArgumentException is thrown. * <p> * If this Field object is enforcing access control (see AccessibleObject) * and this field is not accessible from the current context, an * IllegalAccessException is thrown. * * @param object * the object to access * @return the field value * @throws NullPointerException * if the object is {@code null} and the field is non-static * @throws IllegalArgumentException * if the object is not compatible with the declaring class * @throws IllegalAccessException * if this field is not accessible */ public byte getByte(Object object) throws IllegalAccessException, IllegalArgumentException { checkAccess(object, false); checkReceiver(object); return getByte(object, getType(), Byte.TYPE); }
unspecifiedStoragePolicyId = idUnspecified.getByte(BlockStoragePolicySuite.class);
output.writeByte(field.getByte(obj)); } else if (type == char.class) { output.writeChar(field.getChar(obj));
private String getStoragePolicyNameForOldHDFSVersion(FileSystem fs, Path path) { try { if (fs instanceof DistributedFileSystem) { DistributedFileSystem dfs = (DistributedFileSystem) fs; HdfsFileStatus status = dfs.getClient().getFileInfo(path.toUri().getPath()); if (null != status) { byte storagePolicyId = status.getStoragePolicy(); Field idUnspecified = BlockStoragePolicySuite.class.getField("ID_UNSPECIFIED"); if (storagePolicyId != idUnspecified.getByte(BlockStoragePolicySuite.class)) { BlockStoragePolicy[] policies = dfs.getStoragePolicies(); for (BlockStoragePolicy policy : policies) { if (policy.getId() == storagePolicyId) { return policy.getName(); } } } } } } catch (Throwable e) { LOG.warn("failed to get block storage policy of [" + path + "]", e); } return null; }
@Test public void testGetTypeName() throws IllegalAccessException { assertThat(SerializerDefs.getTypeName(SerializerDefs.TYPE_UNKNOWN)) .contains("unknown"); for (Field field : SerializerDefs.class.getFields()) { if (field.getName().startsWith("TYPE_")) { final byte type = field.getByte(null); if (type != SerializerDefs.TYPE_UNKNOWN) { assertThat(SerializerDefs.getTypeName(type)) .as("Type name is unknown: " + field.getName()) .doesNotContain("unknown"); } } } } }
private short getShort(Object object, Class<?> fieldType, Class<?> expectedType) { if (fieldType == Short.TYPE) { return getS(object, field); } return getByte(object, fieldType, expectedType); }
private short getShort(Object object, Class<?> fieldType, Class<?> expectedType) { if (fieldType == Short.TYPE) { return getS(object, field); } return getByte(object, fieldType, expectedType); }
public void copy (Object original, Object copy) { try { field.setByte(copy, field.getByte(original)); } catch (Exception e) { KryoException ex = new KryoException(e); ex.addTrace(this + " (" + type.getName() + ")"); throw ex; } } }
public void write (Output output, Object object) { try { output.writeByte(field.getByte(object)); } catch (Exception e) { KryoException ex = new KryoException(e); ex.addTrace(this + " (" + type.getName() + ")"); throw ex; } }