/** * 属性を出力ストリームに書き込みます * * @param prop * 属性のローカル名 * @param value * 属性の値 * @throws XMLStreamException */ public StaxWriter writeAttribute(SchemaProperties prop, Object value) throws XMLStreamException { return writeAttribute(prop.getLabel(), prop.getValue(value)); }
@Override public Object getCloneValue(Object obj){ Object value=getValue(obj); if (value==null){ return null; } if(Converters.getDefault().isConvertable(value.getClass())){ return Converters.getDefault().copy(value); } if (value instanceof Set){ return CommonUtils.cloneSet((Set<?>)value); } if (value instanceof List){ return CommonUtils.cloneList((List<?>)value); } if (value instanceof Cloneable){ Method method; try { method = value.getClass().getMethod("clone"); return method.invoke(value); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new RuntimeException(e); } } return value; }
@Override public boolean isEnabled(Object obj){ SchemaProperties dependent=getDependent(); if (dependent!=null&&dependent.isInstanceof(obj)){ DataType dataType=(DataType)dependent.getValue(obj); if (dataType==null||dataType.isFixedSize()){ return true; } return dependent.isEnabled(obj); } return false; } @Override
private static <V extends AbstractSchemaObject<?>> V getSchemaObjectFromParentInternal(String schemaName,String name, DbCommonObject<?> dbObject, BiFunction<String, Schema, V> func) { if (name==null) { return null; } String objSchemaName=(String)SchemaProperties.SCHEMA_NAME.getValue(dbObject); Schema schema; if (CommonUtils.eq(schemaName, objSchemaName)||schemaName==null){ schema = dbObject.getAncestor(Schema.class); } else{ SchemaCollection schemas = dbObject.getAncestor(SchemaCollection.class); if (schemas==null){ return null; } schema = schemas.get(schemaName); } if (schema == null) { return null; } V getObject=func.apply(name, schema); if (getObject != null) { return getObject; } return null; }
@Override public boolean isEnabled(Object obj){ SchemaProperties dependent=getDependent(); if (dependent!=null&&dependent.isInstanceof(obj)){ Long maxLength=(Long)dependent.getValue(obj); if (!CommonUtils.eq(maxLength, this.getValue(obj))){ return true; } return dependent.isEnabled(obj); } return false; } @Override