static int getIntegralSize(Type type, Class typec, Annotations annotations) { if (type == int.class || type == Integer.class) { return 4; } if (type == long.class || type == Long.class) { if (annotations != null) { if (annotations.isAnnotationPresent(Ptr.class)) { return SizeT.SIZE; } if (annotations.isAnnotationPresent(org.bridj.ann.CLong.class)) { return CLong.SIZE; } } return 8; } if (type == CLong.class) { return CLong.SIZE; } if (type == SizeT.class) { return SizeT.SIZE; } if (type == TimeT.class) { return TimeT.SIZE; } if (type == byte.class || type == Byte.class) { return 1; } if (type == char.class || type == Character.class || type == short.class || type == Short.class) { return 2; } if (ValuedEnum.class.isAssignableFrom(typec)) { return 4; } if (Pointer.class.isAssignableFrom(typec)) { return SizeT.SIZE; } return -1; }
public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) { return annotations.isAnnotationPresent(annotationClass); }