本文整理汇总了Java中org.odata4j.edm.EdmProperty.getScale方法的典型用法代码示例。如果您正苦于以下问题:Java EdmProperty.getScale方法的具体用法?Java EdmProperty.getScale怎么用?Java EdmProperty.getScale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.odata4j.edm.EdmProperty
的用法示例。
在下文中一共展示了EdmProperty.getScale方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolvePropertyVariable
import org.odata4j.edm.EdmProperty; //导入方法依赖的package包/类
private Object resolvePropertyVariable(EdmProperty prop, PropertyPath path) {
if (path.getNComponents() == 1) {
String name = path.getLastComponent();
if (Edm.Property.DefaultValue.equals(name)) {
return prop.getDefaultValue();
} else if (Edm.Property.CollectionKind.equals(name)) {
return prop.getCollectionKind().toString();
} else if (Edm.Property.EntityTypeName.equals(name)) {
return prop.getDeclaringType().getName();
} else if (Edm.Property.FixedLength.equals(name)) {
return prop.getFixedLength() != null ? prop.getFixedLength().toString() : null;
} else if (Edm.Property.MaxLength.equals(name)) {
return prop.getMaxLength() != null ? prop.getMaxLength().toString() : null;
} else if (Edm.Property.Name.equals(name)) {
return prop.getName();
} else if (Edm.Property.Namespace.equals(name)) {
return prop.getDeclaringType().getNamespace();
} else if (Edm.Property.Nullable.equals(name)) {
return prop.isNullable() ? "true" : "false";
} else if (Edm.Property.Type.equals(name)) {
return prop.getType().getFullyQualifiedTypeName();
} else if (Edm.Property.Precision.equals(name)) {
return prop.getPrecision() == null ? null : prop.getPrecision().toString();
} else if (Edm.Property.Scale.equals(name)) {
return prop.getScale() == null ? null : prop.getScale().toString();
} else if (decorator != null) {
try {
return decorator.resolvePropertyProperty(prop, path);
} catch (IllegalArgumentException e) {
throw new RuntimeException("EdmProperty property path " + path + " not found");
}
} else {
throw new RuntimeException("EdmProperty property " + name + " not found");
}
} else {
String navProp = path.getFirstComponent();
// --to 1 props only
// TODO: class maybe
throw new RuntimeException("EdmProperty navigation property " + navProp + " not found or not supported");
}
}
示例2: getProperty
import org.odata4j.edm.EdmProperty; //导入方法依赖的package包/类
private OEntity getProperty(EdmStructuralType queryType, EdmStructuralType et, EdmProperty p, Context c) {
List<OProperty<?>> props = new ArrayList<OProperty<?>>();
if (c.pathHelper.isSelected(Edm.Property.Namespace)) {
props.add(OProperties.string(Edm.Property.Namespace, et.getNamespace()));
}
if (c.pathHelper.isSelected(Edm.Property.EntityTypeName)) {
props.add(OProperties.string(Edm.Property.EntityTypeName, et.getName()));
}
if (c.pathHelper.isSelected(Edm.Property.Name)) {
props.add(OProperties.string(Edm.Property.Name, p.getName()));
}
if (c.pathHelper.isSelected(Edm.Property.Type)) {
props.add(OProperties.string(Edm.Property.Type, p.getType().getFullyQualifiedTypeName()));
}
if (c.pathHelper.isSelected(Edm.Property.Nullable)) {
props.add(OProperties.boolean_(Edm.Property.Nullable, p.isNullable()));
}
if (p.getDefaultValue() != null && c.pathHelper.isSelected(Edm.Property.DefaultValue)) {
props.add(OProperties.string(Edm.Property.DefaultValue, p.getDefaultValue()));
}
if (p.getMaxLength() != null && c.pathHelper.isSelected(Edm.Property.MaxLength)) {
props.add(OProperties.int32(Edm.Property.MaxLength, p.getMaxLength()));
}
if (p.getFixedLength() != null && c.pathHelper.isSelected(Edm.Property.FixedLength)) {
props.add(OProperties.boolean_(Edm.Property.FixedLength, p.getFixedLength()));
}
if (p.getPrecision() != null && c.pathHelper.isSelected(Edm.Property.Precision)) {
props.add(OProperties.int32(Edm.Property.Precision, p.getPrecision()));
}
if (p.getScale() != null && c.pathHelper.isSelected(Edm.Property.Scale)) {
props.add(OProperties.int32(Edm.Property.Scale, p.getScale()));
}
if (p.getUnicode() != null && c.pathHelper.isSelected(Edm.Property.Unicode)) {
props.add(OProperties.boolean_(Edm.Property.Unicode, p.getUnicode()));
}
// TODO: collation
// TODO: ConcurrencyMode
if (p.getCollectionKind() != CollectionKind.NONE) {
props.add(OProperties.string(Edm.Property.CollectionKind, p.getCollectionKind().toString()));
}
this.addDocumenation(c, p, props);
addAnnotationProperties(c, p, props);
EdmEntitySet entitySet = edm.findEdmEntitySet(Edm.EntitySets.Properties);
if (this.decorator != null) {
this.decorator.decorateEntity(entitySet, p, queryType, props, c.flatten, c.locale, c.queryInfo != null ? c.queryInfo.customOptions : null);
}
return OEntities.create(entitySet,
OEntityKey.create(Edm.Property.Namespace, et.getNamespace(), Edm.Property.EntityTypeName, et.getName(), Edm.Property.Name, p.getName()),
props,
Collections.<OLink> emptyList());
}
示例3: writeProperties
import org.odata4j.edm.EdmProperty; //导入方法依赖的package包/类
private static void writeProperties(Iterable<EdmProperty> properties, XMLWriter2 writer) {
for (EdmProperty prop : properties) {
writer.startElement(new QName2("Property"));
writer.writeAttribute("Name", prop.getName());
writer.writeAttribute("Type", prop.getType().getFullyQualifiedTypeName());
writer.writeAttribute("Nullable", Boolean.toString(prop.isNullable()));
if (prop.getDefaultValue() != null) {
writer.writeAttribute("DefaultValue", prop.getDefaultValue());
}
if (prop.getMaxLength() != null) {
writer.writeAttribute("MaxLength", Integer.toString(prop.getMaxLength()));
}
if (prop.getFixedLength() != null) {
writer.writeAttribute("FixedLength", Boolean.toString(prop.getFixedLength()));
}
if (!prop.getCollectionKind().equals(CollectionKind.NONE)) {
writer.writeAttribute("CollectionKind", prop.getCollectionKind().toString());
}
if (prop.getPrecision() != null) {
writer.writeAttribute("Precision", Integer.toString(prop.getPrecision()));
}
if (prop.getScale() != null) {
writer.writeAttribute("Scale", Integer.toString(prop.getScale()));
}
if (prop.getCollation() != null) {
writer.writeAttribute("Collation", prop.getCollation());
}
if (prop.getUnicode() != null) {
writer.writeAttribute("Unicode", Boolean.toString(prop.getUnicode()));
}
if (prop.getConcurrencyMode() != null) {
writer.writeAttribute("ConcurrencyMode", prop.getConcurrencyMode());
}
if (prop.getMimeType() != null) {
writer.writeAttribute(new QName2(m, "MimeType", "m"), prop.getMimeType());
}
if (prop.getFcTargetPath() != null) {
writer.writeAttribute(new QName2(m, "FC_TargetPath", "m"), prop.getFcTargetPath());
}
if (prop.getFcKeepInContent() != null) {
writer.writeAttribute(new QName2(m, "FC_KeepInContent", "m"), prop.getFcKeepInContent());
}
if (prop.getFcNsPrefix() != null) {
writer.writeAttribute(new QName2(m, "FC_NsPrefix", "m"), prop.getFcNsPrefix());
}
if (prop.getFcNsUri() != null) {
writer.writeAttribute(new QName2(m, "FC_NsUri", "m"), prop.getFcNsUri());
}
writeAnnotationAttributes(prop, writer);
writeAnnotationElements(prop, writer);
writer.endElement("Property");
}
}