private void validateField(FieldWrap field) { if (field.isStatic() && !field.isFinal()) { // non-final static @Property not supported. throw Events.CFG108_ILLEGAL_MODIFIERS(field.getField()); } if (field.isTransient()) { // transient @Property not supported. throw Events.CFG108_ILLEGAL_MODIFIERS(field.getField()); } if (field.isPrimitive()) { throw new IllegalStateException("Fields cannot be primitive at the moment: " + field.getField()); } } }
private void validateField(FieldWrap<Config> field) { if (field.isStatic() && !field.isFinal()) { // non-final static @Property not supported. throw Events.CFG108_ILLEGAL_MODIFIERS(field.getAnnotation().name()); } if (field.isTransient()) { // transient @Property not supported. throw Events.CFG108_ILLEGAL_MODIFIERS(field.getAnnotation().name()); } } }
private SchemaId getId(ClassIntrospector introspector) { List<FieldWrap> ids = introspector.getFieldList(Id.class); boolean isSingleton = false; if (ids == null || ids.size() == 0) { return null; } else { FieldWrap id = ids.get(0); Id anno = (Id) id.getAnnotation().get(); if ((id.isStatic() && !id.isFinal()) || (id.isFinal() && !id.isStatic())) { throw CFG108_ILLEGAL_MODIFIERS(id.getField()); } String name = anno.name(); if (name == null || "".equals(name)) { name = id.getFieldName(); } return SchemaId.create(name, anno.desc(), isSingleton); } }
private SchemaId getId(ClassIntrospector introspector) { List<FieldWrap<Id>> ids = introspector.getFieldList(Id.class); if (ids == null || ids.size() == 0) { throw CFG103_NO_ID(introspector.getTarget()); } FieldWrap<Id> id = ids.get(0); if ((id.isStatic() && !id.isFinal()) || (id.isFinal() && !id.isStatic())) { throw CFG108_ILLEGAL_MODIFIERS(id.getAnnotation().name()); } boolean isSingleton = false; if (id.isFinal()) { isSingleton = true; } String name = id.getAnnotation().name(); if (name == null || "".equals(name)) { name = id.getFieldName(); } SchemaId schemaId = SchemaId.create(name, id.getAnnotation().desc(), isSingleton); return schemaId; } }