@Override public ProfileKey unwrapMetaValue(MetaValue metaValue) { if(metaValue != null && SimpleMetaType.STRING.equals(metaValue.getMetaType())) { String profileName = String.class.cast(((SimpleValue) metaValue).getValue()); return new ProfileKey(profileName); } throw new IllegalStateException("cannot recreate profile key"); }
/** * Get ref name. * * @param value property value * @return plain value */ protected Object getRefName(Object value) { if (value instanceof MetaValue) { MetaValue metaValue = MetaValue.class.cast(value); if (metaValue.getMetaType().isSimple() == false) { throw new IllegalArgumentException("Can only get ref from simple value: " + value); } return SimpleValue.class.cast(metaValue).getValue(); } return value; }
@Override public ProfileKey unwrapMetaValue(MetaValue metaValue) { if(metaValue != null && SimpleMetaType.STRING.equals(metaValue.getMetaType())) { String profileName = String.class.cast(((SimpleValue) metaValue).getValue()); return new ProfileKey(profileName); } throw new IllegalStateException("cannot recreate profile key"); }
public Version unwrapMetaValue(MetaValue metaValue) { if (SimpleMetaType.STRING.equals(metaValue.getMetaType()) == false) throw new IllegalArgumentException("Not a string: " + metaValue); SimpleValue simple = (SimpleValue) metaValue; String value = (String) simple.getValue(); return Version.parseVersion(value); } }
/** * Unwrap MetaValue. * * @param element the meta value * @param type parent type * @param array parent array * @return unwrapped value */ protected Object unwrapMetaValue(MetaValue element, TypeInfo type, Object array) { TypeInfo elementType; if (type instanceof ClassInfo) elementType = ((ClassInfo)type).getComponentType(); else elementType = getTypeInfo(element.getMetaType(), array); return unwrap(element, elementType); }
/** * Unwrap MetaValue. * * @param element the meta value * @param type parent type * @param array parent array * @return unwrapped value */ protected Object unwrapMetaValue(MetaValue element, TypeInfo type, Object array) { TypeInfo elementType; if (type instanceof ClassInfo) elementType = ((ClassInfo)type).getComponentType(); else elementType = getTypeInfo(element.getMetaType(), array); return unwrap(element, elementType); }
/** * Process the managed property. * * @param persisted the persisted property * @param property the managed property * @param trace enable trace logs * @return the value */ protected MetaValue processManagedProperty(PersistedProperty persisted, ManagedProperty property, boolean trace) { if(persisted == null) throw new IllegalArgumentException("null persisted property"); if(property == null) throw new IllegalArgumentException("null managed property"); MetaValue metaValue = property.getValue(); PersistedValue persistedValue = persisted.getValue(); if(persistedValue != null && isProcessProperty(property, trace)) { MetaType metaType = property.getMetaType(); if(metaValue != null) metaType = metaValue.getMetaType(); // Create the value based on the persisted information metaValue = createValue(persistedValue, metaType); // Update property property.setField(Fields.VALUE, metaValue); if(metaValue != null) property.setField(Fields.META_TYPE, metaValue.getMetaType()); } return metaValue; }
/** * Create the persistence collection value. * * @param value the collection value * @return the collection xml meta data */ protected PersistedCollectionValue createCollectionValue(CollectionValue value) { PersistedCollectionValue collection = new PersistedCollectionValue(); for(MetaValue child : value.getElements()) { PersistedValue persistedValue = createPersistedValue(child, child.getMetaType()); collection.addValue(persistedValue); } return collection; }
componentType = getTypeInfo(metaValue.getMetaType(), null); collection.add(unwrap(metaValue, componentType));
TypeInfo iterTypeInfo = isObjectTypeInfo ? getTypeInfo(metaValue.getMetaType(), null) : componentType; collection.add(unwrap(metaValue, iterTypeInfo));
metaType = metaValue.getMetaType();
if(v.getMetaType().isSimple())
MetaValue value = property.getValue(); if(value != null) metaType = value.getMetaType();
return null; MetaType metaType = metaValue.getMetaType();
metaType = value.getMetaType();
return mapper.unwrapMetaValue(metaValue); MetaType metaType = metaValue.getMetaType(); throw new IllegalArgumentException("Unsupported meta value: " + metaValue.getMetaType());
ctxProp.setField(Fields.META_TYPE, metaValue.getMetaType()); ctxProp.setValue(metaValue);