public Set<Property> getProperties(Class<? extends Object> type) { return getProperties(type, beanAccess); }
/** * Get JavaBean properties to be serialised. The order is respected. This * method may be overridden to provide custom property selection or order. * * @param type * - JavaBean to inspect the properties * @return properties to serialise */ protected Set<Property> getProperties(Class<? extends Object> type) { if (typeDefinitions.containsKey(type)) { return typeDefinitions.get(type).getProperties(); } return getPropertyUtils().getProperties(type); } }
/** * Provide the name of the property which is used when the entries form a * sequence. The property must be a List. * @param bean the class to provide exactly one List property * @return name of the List property */ protected String getSequencePropertyName(Class<?> bean) { Set<Property> properties = getPropertyUtils().getProperties(bean); for (Iterator<Property> iterator = properties.iterator(); iterator.hasNext();) { Property property = iterator.next(); if (!List.class.isAssignableFrom(property.getType())) { iterator.remove(); } } if (properties.size() == 0) { throw new YAMLException("No list property found in " + bean); } else if (properties.size() > 1) { throw new YAMLException( "Many list properties found in " + bean + "; Please override getSequencePropertyName() to specify which property to use."); } return properties.iterator().next().getName(); } }
? propertyUtils.getProperties(type) : propertyUtils.getProperties(type, beanAccess);
public Set<Property> getProperties(Class<? extends Object> type) { return getProperties(type, beanAccess); }
public Set<Property> getProperties(Class<? extends Object> type) throws IntrospectionException { return getProperties(type, beanAccess); }
public Set<Property> getProperties(Class<? extends Object> type) throws IntrospectionException { return getProperties(type, beanAccess); }
/** * Get JavaBean properties to be serialised. The order is respected. This * method may be overridden to provide custom property selection or order. * * @param type * - JavaBean to inspect the properties * @return properties to serialise */ protected Set<Property> getProperties(Class<? extends Object> type) throws IntrospectionException { return getPropertyUtils().getProperties(type); } }
/** * Get JavaBean properties to be serialised. The order is respected. This * method may be overridden to provide custom property selection or order. * * @param type * - JavaBean to inspect the properties * @return properties to serialise */ protected Set<Property> getProperties(Class<? extends Object> type) throws IntrospectionException { return getPropertyUtils().getProperties(type); } }
/** * Get JavaBean properties to be serialised. The order is respected. This * method may be overridden to provide custom property selection or order. * * @param type * - JavaBean to inspect the properties * @return properties to serialise */ protected Set<Property> getProperties(Class<? extends Object> type) { if (typeDefinitions.containsKey(type)) { return typeDefinitions.get(type).getProperties(); } return getPropertyUtils().getProperties(type); } }
/** * Provide the name of the property which is used when the entries form a * sequence. The property must be a List. * @param bean the class to provide exactly one List property * @return name of the List property */ protected String getSequencePropertyName(Class<?> bean) { Set<Property> properties = getPropertyUtils().getProperties(bean); for (Iterator<Property> iterator = properties.iterator(); iterator.hasNext();) { Property property = iterator.next(); if (!List.class.isAssignableFrom(property.getType())) { iterator.remove(); } } if (properties.size() == 0) { throw new YAMLException("No list property found in " + bean); } else if (properties.size() > 1) { throw new YAMLException( "Many list properties found in " + bean + "; Please override getSequencePropertyName() to specify which property to use."); } return properties.iterator().next().getName(); } }
/** * Provide the name of the property which is used when the entries form a * sequence. The property must be a List. * * @throws IntrospectionException */ protected String getSequencePropertyName(Class<?> bean) throws IntrospectionException { Set<Property> properties = getPropertyUtils().getProperties(bean); for (Iterator<Property> iterator = properties.iterator(); iterator.hasNext();) { Property property = iterator.next(); if (!List.class.isAssignableFrom(property.getType())) { iterator.remove(); } } if (properties.size() == 0) { throw new YAMLException("No list property found in " + bean); } else if (properties.size() > 1) { throw new YAMLException( "Many list properties found in " + bean + "; Please override getSequencePropertyName() to specify which property to use."); } return properties.iterator().next().getName(); } }
/** * Provide the name of the property which is used when the entries form a * sequence. The property must be a List. * * @throws IntrospectionException */ protected String getSequencePropertyName(Class<?> bean) throws IntrospectionException { Set<Property> properties = getPropertyUtils().getProperties(bean); for (Iterator<Property> iterator = properties.iterator(); iterator.hasNext();) { Property property = iterator.next(); if (!List.class.isAssignableFrom(property.getType())) { iterator.remove(); } } if (properties.size() == 0) { throw new YAMLException("No list property found in " + bean); } else if (properties.size() > 1) { throw new YAMLException( "Many list properties found in " + bean + "; Please override getSequencePropertyName() to specify which property to use."); } return properties.iterator().next().getName(); } }
? propertyUtils.getProperties(type) : propertyUtils.getProperties(type, beanAccess);
private TypeDescription computeTypeDescription(Class<?> clazz) { TypeDescription typeDescription = new TypeDescription(clazz, new Tag(clazz)); Set<Property> properties = null; try { properties = getPropertyUtils().getProperties(clazz); } catch (IntrospectionException e) { e.printStackTrace(); } if (properties != null) { for (Property property : properties) { if (Collection.class.isAssignableFrom(property.getType()) || property.getClass().isArray()) { Class<?>[] typeArguments = property.getActualTypeArguments(); if (typeArguments != null && typeArguments.length == 1 && typeArguments[0] != null) { typeDescription.putListPropertyType(property.getName(), typeArguments[0]); } } if (Map.class.isAssignableFrom(property.getType())) { Class<?>[] typeArguments = property.getActualTypeArguments(); if (typeArguments != null && typeArguments.length == 2 && typeArguments[0] != null && typeArguments[1] != null) { typeDescription.putMapPropertyType(property.getName(), typeArguments[0], typeArguments[1]); } } } } return typeDescription; }