本文整理汇总了Java中org.simpleframework.xml.Namespace类的典型用法代码示例。如果您正苦于以下问题:Java Namespace类的具体用法?Java Namespace怎么用?Java Namespace使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Namespace类属于org.simpleframework.xml包,在下文中一共展示了Namespace类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extract
import org.simpleframework.xml.Namespace; //导入依赖的package包/类
/**
* This method is used to extract the annotations associated with
* the type. Annotations extracted include the <code>Root</code>
* annotation and the <code>Namespace</code> annotation as well as
* other annotations that are used to describe the type.
*
* @param type this is the type to extract the annotations from
*/
private void extract(Class type) {
for(Annotation label : labels) {
if(label instanceof Namespace) {
namespace(label);
}
if(label instanceof NamespaceList) {
scope(label);
}
if(label instanceof Root) {
root(label);
}
if(label instanceof Order) {
order(label);
}
if(label instanceof Default) {
access(label);
}
}
}
示例2: getNamespaceString
import org.simpleframework.xml.Namespace; //导入依赖的package包/类
private static String getNamespaceString( Class clazz ) {
Namespace namespace = (Namespace) clazz.getAnnotation(Namespace.class);
if (namespace == null) {
Package pkg = clazz.getPackage();
if (pkg != null) {
namespace = pkg.getAnnotation(Namespace.class);
if (namespace == null) { // prior to android v4.3 package annotations aren't supported
namespace = getAnnotation( pkg, Namespace.class );
}
}
}
String ns = "";
if (namespace != null)
ns = namespace.reference();
return ns;
}
示例3: namespace
import org.simpleframework.xml.Namespace; //导入依赖的package包/类
/**
* This is use to scan for <code>Namespace</code> annotations on
* the contact. Once a namespace has been located then it is used
* to populate the internal namespace decorator. This can then be
* used to decorate any output node that requires it.
*
* @param contact this is the contact to scan for namespaces
*/
private void namespace(Contact contact) {
Namespace primary = contact.getAnnotation(Namespace.class);
if(primary != null) {
decorator.set(primary);
decorator.add(primary);
}
}
示例4: scope
import org.simpleframework.xml.Namespace; //导入依赖的package包/类
/**
* This is use to apply for <code>NamespaceList</code> annotations
* on the node. If there is no namespace list then this will return
* and the node will be left unchanged. If however the namespace
* list is not empty the the namespaces are added.
*
* @param node this is the node to apply the namespace list to
*/
private void scope(OutputNode node) {
NamespaceMap map = node.getNamespaces();
for(Namespace next : scope) {
String reference = next.reference();
String prefix = next.prefix();
map.setReference(reference, prefix);
}
}
示例5: annotationType
import org.simpleframework.xml.Namespace; //导入依赖的package包/类
public Class<? extends Annotation> annotationType() {
return Namespace.class;
}
示例6: set
import org.simpleframework.xml.Namespace; //导入依赖的package包/类
/**
* This is used to set the primary namespace for nodes that will
* be decorated by the namespace decorator. If no namespace is set
* using this method then this decorator will leave the namespace
* reference unchanged and only add namespaces for scoping.
*
* @param namespace this is the primary namespace to be set
*/
public void set(Namespace namespace) {
if(namespace != null) {
add(namespace);
}
primary = namespace;
}
示例7: commit
import org.simpleframework.xml.Namespace; //导入依赖的package包/类
/**
* This is used to set the primary namespace for nodes that will
* be decorated by the namespace decorator. If no namespace is set
* using this method then this decorator will leave the namespace
* reference unchanged and only add namespaces for scoping.
*
* @param detail the detail object that contains the namespace
*/
private void commit(Detail detail) {
Namespace namespace = detail.getNamespace();
if(namespace != null) {
decorator.set(namespace);
}
}
示例8: getNamespace
import org.simpleframework.xml.Namespace; //导入依赖的package包/类
/**
* This returns the <code>Namespace</code> annotation that was
* declared on the type. If no annotation has been declared on the
* type this will return null as not belonging to any.
*
* @return this returns the namespace this type belongs to, if any
*/
public Namespace getNamespace() {
return detail.getNamespace();
}
示例9: getNamespace
import org.simpleframework.xml.Namespace; //导入依赖的package包/类
/**
* This returns the <code>Namespace</code> annotation that was
* declared on the type. If no annotation has been declared on the
* type this will return null as not belonging to any.
*
* @return this returns the namespace this type belongs to, if any
*/
public Namespace getNamespace() {
return namespace;
}
示例10: getNamespace
import org.simpleframework.xml.Namespace; //导入依赖的package包/类
/**
* This returns the <code>Namespace</code> annotation that was
* declared on the type. If no annotation has been declared on the
* type this will return null as not belonging to any.
*
* @return this returns the namespace this type belongs to, if any
*/
Namespace getNamespace();
示例11: NamespaceDecorator
import org.simpleframework.xml.Namespace; //导入依赖的package包/类
/**
* Constructor for the <code>NamespaceDecorator</code> object. A
* namespace decorator can be used for applying namespaces to a
* specified node. It can add namespaces to set the scope of the
* namespace reference to the node and it can also be used to set
* the primary namespace reference used for the node.
*/
public NamespaceDecorator() {
this.scope = new ArrayList<Namespace>();
}
示例12: add
import org.simpleframework.xml.Namespace; //导入依赖的package包/类
/**
* This is used to add a namespace to the decorator so that it can
* be added to decorated nodes. Namespaces that are added will be
* set on the element so that child elements can reference the
* namespace and will thus inherit the prefix from that elment.
*
* @param namespace this is the namespace to be added for scoping
*/
public void add(Namespace namespace) {
scope.add(namespace);
}