/** * Create an enum value * * @param <T> the enum type * @param type the type * @param value the value * @return the enum value */ public static <T extends Enum<?>> EnumValue createEnumValue(EnumMetaType type, T value) { if (value == null) return null; return new EnumValueSupport(type, value.name()); }
/** * Create an enum value * * @param <T> the enum type * @param type the type * @param value the value * @return the enum value */ public static <T extends Enum> EnumValue createEnumValue(EnumMetaType type, T value) { if (value == null) return null; return new EnumValueSupport(type, value.name()); }
/** * Process an Enum value. * * @param enumElement the persisted xml meta data * @param value the enum value * @return a enum value */ protected EnumValue createEnumValue(PersistedEnumValue enumElement, EnumMetaType type) { return new EnumValueSupport(type, enumElement.getValue()); }
@Override public MetaValue createMetaValue(MetaType metaType, SecurityMetaData object) { if(object == null) return null; if(metaType instanceof CompositeMetaType) { // Extract the meta types CompositeMetaType composite = (CompositeMetaType) metaType; EnumMetaType enumMetaType= (EnumMetaType) composite.getType(DeploymentTypeName); // Create the composite value CompositeValueSupport securityDomain = new CompositeValueSupport(composite); // Set a default deplooymentType SecurityDeploymentType deploymentType = object.getSecurityDeploymentType(); if(deploymentType == null) deploymentType = SecurityDeploymentType.NONE; // Set domain and deployment type securityDomain.set(DOMAIN, SimpleValueSupport.wrap(object.getDomain())); securityDomain.set(DeploymentTypeName, new EnumValueSupport(enumMetaType, deploymentType)); // return securityDomain; } throw new IllegalArgumentException("Cannot convert securityDomain " + object); }