本文整理了Java中com.thoughtworks.xstream.XStream.aliasAttribute()
方法的一些代码示例,展示了XStream.aliasAttribute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XStream.aliasAttribute()
方法的具体详情如下:
包路径:com.thoughtworks.xstream.XStream
类名称:XStream
方法名:aliasAttribute
[英]Create an alias for an attribute.
[中]为属性创建别名。
代码示例来源:origin: geoserver/geoserver
@Override
public void init(XStreamPersister persister) {
persister.getXStream().alias("sweetBanana", SweetBanana.class);
persister
.getXStream()
.aliasAttribute(SweetBanana.class, "scientificName", "name");
persister.registerBreifMapComplexType("sweetBanana", SweetBanana.class);
}
});
代码示例来源:origin: org.jvnet.hudson/xstream
/**
* @deprecated As of 1.2, use
* {@link #XStream(ReflectionProvider, Mapper, HierarchicalStreamDriver)} and
* register classAttributeIdentifier as alias
*/
public XStream(
ReflectionProvider reflectionProvider, ClassMapper classMapper,
HierarchicalStreamDriver driver, String classAttributeIdentifier) {
this(reflectionProvider, (Mapper)classMapper, driver);
aliasAttribute(classAttributeIdentifier, "class");
}
代码示例来源:origin: ovea-deprecated/jetty-session-redis
/**
* @deprecated As of 1.2, use
* {@link #XStream(ReflectionProvider, Mapper, HierarchicalStreamDriver)} and
* register classAttributeIdentifier as alias
*/
public XStream(
ReflectionProvider reflectionProvider, ClassMapper classMapper,
HierarchicalStreamDriver driver, String classAttributeIdentifier) {
this(reflectionProvider, (Mapper)classMapper, driver);
aliasAttribute(classAttributeIdentifier, "class");
}
代码示例来源:origin: stackoverflow.com
XStream xs = new XStream();
xs.alias("person", Person.class);
xs.aliasAttribute(Person.class, "mom", "mother");
代码示例来源:origin: hneemann/Digital
/**
* Creates a proper configured XStream instance
*
* @return the XStream instance
*/
public static XStream getxStream() {
XStream xStream = new XStream(new StaxDriver());
xStream.alias("fsm", FSM.class);
xStream.alias("state", State.class);
xStream.alias("transition", Transition.class);
xStream.alias("vector", Vector.class);
xStream.aliasAttribute(Vector.class, "x", "x");
xStream.aliasAttribute(Vector.class, "y", "y");
xStream.alias("vectorf", VectorFloat.class);
xStream.aliasAttribute(VectorFloat.class, "x", "x");
xStream.aliasAttribute(VectorFloat.class, "y", "y");
return xStream;
}
代码示例来源:origin: hneemann/Digital
private static XStream getxStream() {
XStream xStream = new XStream(new StaxDriver());
xStream.alias("truthTable", TruthTable.class);
xStream.alias("variable", Variable.class);
xStream.aliasAttribute(Variable.class, "identifier", "name");
xStream.alias("result", Result.class);
xStream.alias("BoolTable", BoolTableByteArray.class);
xStream.alias("BoolTableEx", BoolTableExpanded.class);
return xStream;
}
代码示例来源:origin: org.eclipse.smarthome.extensionservice/org.eclipse.smarthome.extensionservice.marketplace
@Override
public void registerAliases(XStream xstream) {
xstream.alias("marketplace", Marketplace.class);
xstream.addImplicitArray(Marketplace.class, "categories");
xstream.alias("category", Category.class);
xstream.addImplicitArray(Category.class, "nodes");
xstream.alias("node", Node.class);
xstream.aliasAttribute(Node.class, "id", "id");
xstream.aliasAttribute(Node.class, "name", "name");
// ignore what we do not know
xstream.ignoreUnknownElements();
}
代码示例来源:origin: stackoverflow.com
xstream.alias("ChildList", ChildList.class);
xstream.alias("child", Child.class);
xstream.aliasAttribute(Concept.class, "id", "id");
xstream.aliasAttribute(Concept.class, "name", "name");
xstream.aliasAttribute(Concept.class, "table", "table");
xstream.aliasAttribute(Child.class, "id", "id");
xstream.aliasAttribute(Child.class, "name", "name");
xstream.aliasAttribute(Child.class, "childTable", "childTable");
xstream.aliasAttribute(Child.class, "rel", "rel");
xstream.addImplicitCollection(ChildList.class, "childList");
xstream.addImplicitCollection(Concepts.class, "conceptList");
代码示例来源:origin: org.geoserver/gs-restconfig
/**
* Configure x-stream for XML encoding of link
*
* @param xStream
*/
public static void configureXML(XStream xStream) {
xStream.alias("atom:link", AtomLink.class);
xStream.useAttributeFor(AtomLink.class, "href");
xStream.useAttributeFor(AtomLink.class, "rel");
xStream.useAttributeFor(AtomLink.class, "type");
xStream.aliasAttribute(AtomLink.class, "NAMESPACE", "xmlns:atom");
}
代码示例来源:origin: hneemann/Digital
xStream.alias("direction", LeftRightFormat.class);
xStream.alias("rotation", Rotation.class);
xStream.aliasAttribute(Rotation.class, "rotation", "rotation");
xStream.alias("language", Language.class);
xStream.aliasAttribute(Language.class, "name", "name");
xStream.alias("vector", Vector.class);
xStream.aliasAttribute(Vector.class, "x", "x");
xStream.aliasAttribute(Vector.class, "y", "y");
xStream.alias("value", InValue.class);
xStream.aliasAttribute(InValue.class, "value", "v");
xStream.aliasAttribute(InValue.class, "highZ", "z");
xStream.addImplicitCollection(ElementAttributes.class, "attributes");
xStream.alias("data", DataField.class);
代码示例来源:origin: CityOfNewYork/geoclient
xStream.aliasAttribute(Filter.class, CLASS_FILTER_PROPERTY_PATTERN, XML_FILTER_ATTRIBUTE_PATTERN);
xStream.aliasAttribute(WorkAreaConfig.class, CLASS_WORK_AREA_PROPERTY_ID, XML_WORK_AREA_ATTRIBUTE_ID);
xStream.aliasAttribute(WorkAreaConfig.class, CLASS_WORK_AREA_PROPERTY_IS_WA1, XML_WORK_AREA_ATTRIBUTE_IS_WA1);
xStream.aliasAttribute(FunctionConfig.class, CLASS_FUNCTION_PROPERTY_ID, XML_FUNCTION_ATTRIBUTE_ID);
代码示例来源:origin: org.tinygroup/fileresolver
private void processPropertyAlias(XStream xStream,
XStreamClassAlias classAlias, Class<?> clazz) {
for (XStreamPropertyAlias propertyAlias : classAlias.getProperAliases()) {
xStream.aliasAttribute(clazz, propertyAlias.getAttributeName(),
propertyAlias.getAliasName());
}
}
代码示例来源:origin: CityOfNewYork/geoclient
xStream.aliasAttribute(ItemDocumentation.class, CLASS_DOCUMENTATION_PROPERTY_ID, XML_DOCUMENTATION_ATTRIBUTE_ID);
xStream.aliasAttribute(Table.class, CLASS_TABLE_PROPERTY_ID, XML_TABLE_ATTRIBUTE_ID);
xStream.aliasAttribute(GroupDocumentation.class, CLASS_GROUP_DOCUMENTATION_PROPERTY_ID, XML_GROUP_DOCUMENTATION_ATTRIBUTE_ID);
xStream.aliasAttribute(GroupMember.class, CLASS_GROUP_MEMBER_PROPERTY_ID, XML_GROUP_MEMBER_ATTRIBUTE_ID);
xStream.aliasAttribute(GroupMember.class, CLASS_GROUP_MEMBER_PROPERTY_SIZE_INDICATOR, XML_GROUP_MEMBER_ATTRIBUTE_SIZE_INDICATOR);
代码示例来源:origin: org.geoserver.community/gs-notification-common
@Override
public void init(XStream xs) {
xs.aliasAttribute(DefaultNotificationProcessor.class, "sender", name);
xs.registerLocalConverter(
DefaultNotificationProcessor.class,
"sender",
new SenderConverter(xs.getMapper(), xs.getReflectionProvider(), this));
}
代码示例来源:origin: org.geoserver.community/gs-notification-common
@Override
public void init(XStream xs) {
xs.aliasAttribute(DefaultNotificationProcessor.class, "encoder", name);
xs.registerLocalConverter(
DefaultNotificationProcessor.class,
"encoder",
new EncoderConverter(xs.getMapper(), xs.getReflectionProvider(), this));
}
代码示例来源:origin: bcdev/beam
xStream.aliasAttribute(HeaderTarget.class, "nodeId", "refid");
代码示例来源:origin: GeoWebCache/geowebcache
xs.aliasAttribute(BlobStoreInfo.class, "_default", "default");
代码示例来源:origin: io.provis/provisio-model
xstream.aliasAttribute(ArtifactSet.class, "directory", "to");
xstream.aliasAttribute(ArtifactSet.class, "reference", "ref");
xstream.addImplicitCollection(ArtifactSet.class, "artifacts", ProvisioArtifact.class);
xstream.alias("exclude", Exclusion.class);
xstream.useAttributeFor(File.class, "path");
xstream.useAttributeFor(File.class, "touch");
xstream.aliasAttribute(File.class, "name", "as");
代码示例来源:origin: org.tinygroup/org.tinygroup.xstream
private static void processClassProperty(XStream xStream, XStreamClassPropertyAlias propertyAlias, Class<?> clazz) {
String propertyName = propertyAlias.getPropertyName();
Field field = ClassFiledUtil.getDeclaredFieldWithParent(clazz, propertyName);
String aliasName = propertyAlias.getAliasName();
boolean asTttribute = propertyAlias.isAsTttribute();
boolean implicit = propertyAlias.isImplicit();
boolean omit = propertyAlias.isOmit();
if (omit) {
xStream.omitField(clazz, propertyName);
}
if (implicit && field != null) {
if (field.getType().isArray()) {
xStream.addImplicitArray(clazz, propertyName);
} else if (ClassFiledUtil.implmentInterface(field.getType(),
Collection.class)) {
xStream.addImplicitCollection(clazz, propertyName);
}
}
if (!StringUtil.isBlank(aliasName)) {
if (!asTttribute) {
xStream.aliasField(aliasName, clazz, propertyName);
} else {
xStream.aliasAttribute(clazz, propertyName, aliasName);
}
}
}
//
代码示例来源:origin: org.geoserver.community.backuprestore/gs-backup-restore-rest
xStream.aliasAttribute(AbstractExecutionAdapter.class, "delegate", "execution");
xStream.omitField(JobExecution.class, "version");
xStream.omitField(JobExecution.class, "jobInstance");
内容来源于网络,如有侵权,请联系作者删除!