Code example for Field

Methods: getAnnotation, getDeclaringClass

0
 */ 
public class DefaultField2Desc implements Field2Desc { 
 
	@Override 
	public ByteFieldDesc genDesc(Field field) {
		ByteField byteField = field.getAnnotation(ByteField.class);
		Class<?> clazz = field.getDeclaringClass();
		if (null != byteField) {
			try { 
				DefaultFieldDesc desc = new DefaultFieldDesc()
						.setField(field)
						.setIndex(byteField.index())
						.setByteSize(byteField.bytes())
						.setCharset(byteField.charset())
						.setLengthField( 
								byteField.length().equals("") ? null : clazz
										.getDeclaredField(byteField.length()))
						.setFixedLength(byteField.fixedLength());
				return desc;
			} catch (SecurityException e) {
				e.printStackTrace();