/** * Process generic value. * * @param genericValue the generic value * @param md the managed deployment * @throws Exception for any error */ protected void processGenericValue(GenericValue genericValue, ManagedDeployment md, ProfileViewProcessingContext context) throws Exception { // TODO: a null is probably an error condition if (genericValue != null) { ManagedObject propMO = ManagedObject.class.cast(genericValue.getValue()); // TODO: a null is probably an error condition if (propMO != null) { processManagedObject(propMO, md, context); } } }
@Override public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj instanceof GenericValue == false) return false; GenericValue other = (GenericValue) obj; if (metaType.equals(other.getMetaType()) == false) return false; Object otherValue = other.getValue(); if (value == null && otherValue == null) return true; if (value == null && otherValue != null) return false; return value.equals(otherValue); }
@SuppressWarnings("unchecked") protected Collection<?> unwrapGenericCollection(CollectionValue collection, PropertyInfo propertyInfo) throws Throwable { // Create a new collection BeanInfo beanInfo = configuration.getBeanInfo(propertyInfo.getType()); Collection newCollection = (Collection) createNewInstance(beanInfo); // unwrap generic collection for(MetaValue value : collection.getElements()) { ManagedObject o = (ManagedObject) ((GenericValue)value).getValue(); newCollection.add(o.getAttachment()); } return newCollection; }
@Override public boolean equals(Object obj) { if (obj == this) return true; if (obj == null || obj instanceof GenericValue == false) return false; GenericValue other = (GenericValue) obj; if (metaType.equals(other.getMetaType()) == false) return false; Object otherValue = other.getValue(); if (value == null && otherValue == null) return true; if (value == null && otherValue != null) return false; return value.equals(otherValue); }
/** * Create the persistence generic value. * * @param value the generic value * @param the persisted generic value * @return the generic xml meta data */ protected PersistedGenericValue createGenericValue(GenericValue value, PersistedGenericValue generic) { Object o = value.getValue(); if(o == null) return generic; if(o instanceof ManagedObject) { PersistedManagedObject mo; if(generic.getManagedObject() == null) mo = plugin.createPersistedManagedObject((ManagedObject) o); else mo = plugin.createPersistedManagedObject(generic.getManagedObject(), (ManagedObject) o); generic.setManagedObject(mo); } else { throw new IllegalStateException("The value of GenericValue must be a ManagedObject: " + value); } return generic; }
Serializable value = ((GenericValue)metaValue).getValue(); return getValue(metaType, type, value);
Serializable value = ((GenericValue)metaValue).getValue(); return getValue(metaType, type, value);