/** * Creates a {@link GoogleBaseAttribute} of type * {@link GoogleBaseAttributeType#GROUP} and initializes it using the * current state of the object. Sub-attributes of group with type * GROUP or GROUP's derived types are ignored. * * @param name attribute name * @param group attribute value * @return a new {@link com.google.api.gbase.client.GoogleBaseAttribute} */ public static GoogleBaseAttribute createAttribute(String name, Group group) { GoogleBaseAttribute attribute = new GoogleBaseAttribute(name, GoogleBaseAttributeType.GROUP); Multimap<String, GoogleBaseAttribute> subAttributes = group.getAllSubAttributes(); for (GoogleBaseAttribute attr : subAttributes.values()) { GoogleBaseAttributeType type = attr.getType(); if (!GoogleBaseAttributeType.GROUP.equals(type) && !GoogleBaseAttributeType.GROUP.equals(type.getSupertype()) && (attr.hasValue() || attr.hasSubElements())) { attribute.addSubAttribute(attr); } } return attribute; }
/** * Creates a {@link GoogleBaseAttribute} of type * {@link GoogleBaseAttributeType#GROUP} and initializes it using the * current state of the object. Sub-attributes of group with type * GROUP or GROUP's derived types are ignored. * * @param name attribute name * @param group attribute value * @return a new {@link com.google.api.gbase.client.GoogleBaseAttribute} */ public static GoogleBaseAttribute createAttribute(String name, Group group) { GoogleBaseAttribute attribute = new GoogleBaseAttribute(name, GoogleBaseAttributeType.GROUP); Multimap<String, GoogleBaseAttribute> subAttributes = group.getAllSubAttributes(); for (GoogleBaseAttribute attr : subAttributes.values()) { GoogleBaseAttributeType type = attr.getType(); if (!GoogleBaseAttributeType.GROUP.equals(type) && !GoogleBaseAttributeType.GROUP.equals(type.getSupertype()) && (attr.hasValue() || attr.hasSubElements())) { attribute.addSubAttribute(attr); } } return attribute; }