List of usage examples for com.fasterxml.jackson.databind.introspect AnnotatedMember getDeclaringClass
public abstract Class<?> getDeclaringClass();
From source file:java2typescript.jackson.module.visitors.TSJsonObjectFormatVisitor.java
private AbstractType getTSTypeForClass(AnnotatedMember member) { TypeBindings bindings = new TypeBindings(TypeFactory.defaultInstance(), member.getDeclaringClass()); JavaType javaType = member.getType(bindings); if (javaType.getRawClass().getSimpleName().equals("Observable")) { javaType = javaType.containedType(0); }/* w w w . j ava 2 s. co m*/ BeanProperty prop = new BeanProperty.Std(member.getName(), javaType, NO_NAME, new AnnotationMap(), member, false); try { return getTSTypeForProperty(prop); } catch (JsonMappingException e) { throw new RuntimeException(e); } }
From source file:net.kuujo.vertigo.util.serialization.impl.InclusiveAnnotationIntrospector.java
@Override public boolean hasIgnoreMarker(AnnotatedMember member) { Boolean ignore = super.hasIgnoreMarker(member); if (ignore != null && ignore) { return true; }/*from w ww. ja va2 s .c o m*/ return !isSerializableType(member.getDeclaringClass()); }
From source file:org.craftercms.commons.jackson.mvc.CrafterJacksonAnnotationIntrospector.java
@Override public boolean hasIgnoreMarker(final AnnotatedMember m) { if (m.getAnnotated().isAnnotationPresent(Exclude.class)) { return true; } else if (m.getAnnotated().isAnnotationPresent(SecureProperty.class) && securityPropertyFilter != null) { SecureProperty property = m.getAnnotated().getAnnotation(SecureProperty.class); return securityPropertyFilter.suppressProperty( m.getDeclaringClass().getCanonicalName() + "." + m.getName(), property.role()); } else {// w w w .j av a 2s .c o m return super.hasIgnoreMarker(m); } }
From source file:com.basho.riak.client.convert.RiakBeanSerializerModifier.java
/** * Checks if the property has any of the Riak annotations on it or the * Jackson JsonProperty annotation. /*from w ww . j a va2s .c o m*/ * * If a Riak annotation is present without the Jackson JsonProperty * annotation, this will return false. * * If a property has been annotated with both the Jackson JsonProperty * annotation and a Riak annotation, the Jackson annotation takes precedent * and this will return true. * * @param beanPropertyWriter * a {@link BeanPropertyWriter} to check for Riak* annotations * @return true if the property is not Riak annotated or is Jackson * JsonProperty annotated, false otherwise */ private boolean keepProperty(BeanPropertyWriter beanPropertyWriter) { RiakKey key = null; RiakUsermeta usermeta = null; RiakLinks links = null; RiakIndex index = null; RiakVClock vclock = null; JsonProperty jacksonJsonProperty = null; RiakTombstone tombstone = null; AnnotatedMember member = beanPropertyWriter.getMember(); if (member instanceof AnnotatedField) { AnnotatedElement element = member.getAnnotated(); key = element.getAnnotation(RiakKey.class); usermeta = element.getAnnotation(RiakUsermeta.class); links = element.getAnnotation(RiakLinks.class); index = element.getAnnotation(RiakIndex.class); vclock = element.getAnnotation(RiakVClock.class); tombstone = element.getAnnotation(RiakTombstone.class); jacksonJsonProperty = element.getAnnotation(JsonProperty.class); } else { @SuppressWarnings("rawtypes") Class clazz = member.getDeclaringClass(); Field field; try { field = clazz.getDeclaredField(beanPropertyWriter.getName()); key = field.getAnnotation(RiakKey.class); usermeta = field.getAnnotation(RiakUsermeta.class); links = field.getAnnotation(RiakLinks.class); index = field.getAnnotation(RiakIndex.class); vclock = field.getAnnotation(RiakVClock.class); tombstone = field.getAnnotation(RiakTombstone.class); jacksonJsonProperty = field.getAnnotation(JsonProperty.class); } catch (SecurityException e) { throw new RuntimeException(e); } catch (NoSuchFieldException e) { // ignore, not a field means not a Riak annotated field. } } if (jacksonJsonProperty != null) { return true; } else { return key == null && usermeta == null && links == null && vclock == null && index == null && tombstone == null; } }