Intro { public JFishProperty getJFishProperty(String propName, boolean isField){ if(StringUtils.isBlank(propName)){ return null; } JFishProperty prop = null; if(isField){ try { prop = fieldInfoCaches.get(propName); } catch (ExecutionException e) { throw new BaseException("getJFishProperty error", e); } }else{ try { prop = propertyInfoCaches.get(propName); } catch (UncheckedExecutionException e) { if(e.getCause() instanceof NoSuchElementException){ return null; } throw e; }catch (ExecutionException e) { throw new BaseException("getJFishProperty error", e); } } return prop; } Intro(Class<T> clazz); static Intro<E> wrap(Class<E> clazz); Class<?> getClazz(); boolean isMap(); boolean isCollection(); boolean isArray(); List<Field> getAllFields(); List<String> getAllPropertyNames(); @SuppressWarnings("unchecked") List<String> getPropertyNames(final Class<? extends Annotation>... ignoreAnnotation); @SuppressWarnings("unchecked") JFishList<PropertyDescriptor> getPropertyDescriptors(final Class<? extends Annotation>... ignoreAnnotations); Map<String, Field> getAllFieldMap(); Map<String, Field> getFieldMaps(); Map<String, PropertyDescriptor> getPropertyDescriptors(); Collection<PropertyDescriptor> getProperties(); PropertyDescriptor[] getPropertyArray(); PropertyDescriptor getProperty(String propName); PropertyDescriptor checkProperty(String propName); boolean hasProperty(String propName); Map<String, JFishProperty> getJFishProperties(); JFishProperty getJFishProperty(String propName, boolean isField); Collection<Field> getFields(); List<Field> getFieldList(boolean parent); Field getField(String fieldName); boolean containsField(String fieldName, boolean includeParent); Field getField(String fieldName, boolean parent); Field getStaticField(String fieldName); Field checkField(String fieldName, boolean parent); Object getStaticFieldValue(String fieldName, boolean parent); static Object getFieldValue(Field f, Object obj, boolean throwIfError); static void setFieldValue(Field f, Object obj, Object value); Object getFieldValue(Object obj, String fieldName); Object getFieldValue(Object obj, String fieldName, boolean parent); void setFieldValue(Object obj, String fieldName, Object value); void setFieldValue(Object obj, String fieldName, Object value, boolean parent); void setStaticFieldValue(Object value, String fieldName); void setStaticFieldValue(Object value, String fieldName, boolean parent); @SuppressWarnings({ "unchecked", "rawtypes" }) T newInstance(); T newInstance(Map<String, ?> propValues, TypeJudge typeJudge); T newBy(Map<String, ?> propValues); T newFrom(Map<?, ?> propValues); Object setPropertyValue(Object element, String propName, Object value); Object setPropertyValue(Object element, PropertyDescriptor pd, Object value); Object getPropertyValue(Object element, String propName); Object getPropertyValue(Object element, PropertyDescriptor pd); Method getReadMethod(String propName); Method getWriteMethod(String propName); static String getReadMethodName(String propName, Class<?> returnType); static String getWriteMethodName(String name); Collection<String> desribPropertyNames(); void copy(Object source, Object target, PropertyCopyer<PropertyDescriptor> copyer); Method findMethod(String name, Class<?>... paramTypes); List<Class<?>> findSuperClasses(); List<Class<?>> findSuperClasses(Class<?> stopClass); Collection<Field> getNotStaticAndTransientFields(boolean parent); E getAnnotationWithParent(Class<E> annotationClass); E getAnnotationWithSupers(Class<E> annotationClass); E getAnnotationWithInterfaces(Class<E> annotationClass); String toString(); @Override int hashCode(); @Override boolean equals(Object obj); static final String JAVASSIST_KEY; static final String READMETHOD_KEY; static final String BOOLEAN_READMETHOD_KEY; static final String WRITEMETHOD_KEY; }
@Test public void testJFishProperty(){ Intro<IntroTestClass> intro = ClassIntroManager.getInstance().getIntro(IntroTestClass.class); assertThat(intro.getJFishProperty("name", false).hasAnnotation(FieldName.class)).isTrue(); }