当前位置: 首页>>代码示例>>Java>>正文


Java ID.IDREF属性代码示例

本文整理汇总了Java中com.sun.xml.internal.bind.v2.model.core.ID.IDREF属性的典型用法代码示例。如果您正苦于以下问题:Java ID.IDREF属性的具体用法?Java ID.IDREF怎么用?Java ID.IDREF使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.sun.xml.internal.bind.v2.model.core.ID的用法示例。


在下文中一共展示了ID.IDREF属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: link

public void link() {
    super.link();

    if (!(NonElement.ANYTYPE_NAME.equals(type.getTypeName()) || type.isSimpleType() || id()==ID.IDREF)) {
            parent.builder.reportError(new IllegalAnnotationException(
            Messages.SIMPLE_TYPE_IS_REQUIRED.format(),
            seed
        ));
    }

    if(!isCollection() && seed.hasAnnotation(XmlList.class)) {
        parent.builder.reportError(new IllegalAnnotationException(
            Messages.XMLLIST_ON_SINGLE_PROPERTY.format(), this
        ));
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:SingleTypePropertyInfoImpl.java

示例2: isLeaf

/**
 * Look for the case that can be optimized as a leaf,
 * which is a kind of type whose XML representation is just PCDATA.
 */
static boolean isLeaf(RuntimePropertyInfo info) {
    Collection<? extends RuntimeTypeInfo> types = info.ref();
    if(types.size()!=1)     return false;

    RuntimeTypeInfo rti = types.iterator().next();
    if(!(rti instanceof RuntimeNonElement)) return false;

    if(info.id()==ID.IDREF)
        // IDREF is always handled as leaf -- Transducer maps IDREF String back to an object
        return true;

    if(((RuntimeNonElement)rti).getTransducer()==null)
        // Transducer!=null means definitely binds to PCDATA.
        // even if transducer==null, a referene might be IDREF,
        // in which case it will still produce PCDATA in this reference.
        return false;

    if(!info.getIndividualType().equals(rti.getType()))
        return false;

    return true;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:PropertyFactory.java

示例3: get

/**
 * Gets the {@link TransducedAccessor} appropriately configured for
 * the given property.
 *
 * <p>
 * This allows the implementation to use an optimized code.
 */
public static <T> TransducedAccessor<T> get(JAXBContextImpl context, RuntimeNonElementRef ref) {
    Transducer xducer = RuntimeModelBuilder.createTransducer(ref);
    RuntimePropertyInfo prop = ref.getSource();

    if(prop.isCollection()) {
        return new ListTransducedAccessorImpl(xducer,prop.getAccessor(),
                Lister.create(Utils.REFLECTION_NAVIGATOR.erasure(prop.getRawType()), prop.id(), prop.getAdapter()));
    }

    if(prop.id()==ID.IDREF)
        return new IDREFTransducedAccessorImpl(prop.getAccessor());

    if(xducer.isDefault() && context != null && !context.fastBoot) {
        TransducedAccessor xa = OptimizedTransducedAccessorFactory.get(prop);
        if(xa!=null)    return xa;
    }

    if(xducer.useNamespace())
        return new CompositeContextDependentTransducedAccessorImpl( context, xducer, prop.getAccessor() );
    else
        return new CompositeTransducedAccessorImpl( context, xducer, prop.getAccessor() );
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:TransducedAccessor.java

示例4: get

/**
 * Gets the {@link TransducedAccessor} appropriately configured for
 * the given property.
 *
 * <p>
 * This allows the implementation to use an optimized code.
 */
public static <T> TransducedAccessor<T> get(JAXBContextImpl context, RuntimeNonElementRef ref) {
    Transducer xducer = RuntimeModelBuilder.createTransducer(ref);
    RuntimePropertyInfo prop = ref.getSource();

    if(prop.isCollection()) {
        return new ListTransducedAccessorImpl(xducer,prop.getAccessor(),
                Lister.create(Navigator.REFLECTION.erasure(prop.getRawType()),prop.id(),
                prop.getAdapter()));
    }

    if(prop.id()==ID.IDREF)
        return new IDREFTransducedAccessorImpl(prop.getAccessor());

    if(xducer.isDefault() && context != null && !context.fastBoot) {
        TransducedAccessor xa = OptimizedTransducedAccessorFactory.get(prop);
        if(xa!=null)    return xa;
    }

    if(xducer.useNamespace())
        return new CompositeContextDependentTransducedAccessorImpl( context, xducer, prop.getAccessor() );
    else
        return new CompositeTransducedAccessorImpl( context, xducer, prop.getAccessor() );
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:30,代码来源:TransducedAccessor.java

示例5: calcId

private ID calcId() {
    // TODO: share code with PropertyInfoImpl
    if(reader().hasMethodAnnotation(XmlID.class,method)) {
        return ID.ID;
    } else
    if(reader().hasMethodAnnotation(XmlIDREF.class,method)) {
        return ID.IDREF;
    } else {
        return ID.NONE;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:ElementInfoImpl.java

示例6: calcId

private ID calcId() {
    if(seed.hasAnnotation(XmlID.class)) {
        // check the type
        if(!nav().isSameType(getIndividualType(), nav().ref(String.class)))
            parent.builder.reportError(new IllegalAnnotationException(
                Messages.ID_MUST_BE_STRING.format(getName()), seed )
            );
        return ID.ID;
    } else
    if(seed.hasAnnotation(XmlIDREF.class)) {
        return ID.IDREF;
    } else {
        return ID.NONE;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:PropertyInfoImpl.java

示例7: link

/**
 * Called after all the {@link TypeInfo}s are collected into the governing {@link TypeInfoSet}.
 *
 * Derived class can do additional actions to complete the model.
 */
protected void link() {
    if(id==ID.IDREF) {
        // make sure that the refereced type has ID
        for (TypeInfo<T,C> ti : ref()) {
            if(!ti.canBeReferencedByIDREF())
                parent.builder.reportError(new IllegalAnnotationException(
                Messages.INVALID_IDREF.format(
                    parent.builder.nav.getTypeName(ti.getType())), this ));
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:PropertyInfoImpl.java

示例8: create

/**
 * Gets a reference to the appropriate {@link Lister} object
 * if the field is a multi-value field. Otherwise null.
 *
 * @param fieldType
 *      the type of the field that stores the collection
 * @param idness
 *      ID-ness of the property.
 * @param adapter
 *      adapter to be used for individual items. can be null.
 */
public static <BeanT,PropT,ItemT,PackT>
    Lister<BeanT,PropT,ItemT,PackT> create(Type fieldType,ID idness, Adapter<Type,Class> adapter) {

    Class rawType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(fieldType);
    Class itemType;

    Lister l;
    if( rawType.isArray() ) {
        itemType = rawType.getComponentType();
        l = getArrayLister(itemType);
    } else
    if( Collection.class.isAssignableFrom(rawType) ) {
        Type bt = Utils.REFLECTION_NAVIGATOR.getBaseClass(fieldType,Collection.class);
        if(bt instanceof ParameterizedType)
            itemType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(((ParameterizedType)bt).getActualTypeArguments()[0]);
        else
            itemType = Object.class;
        l = new CollectionLister(getImplClass(rawType));
    } else
        return null;

    if(idness==ID.IDREF)
        l = new IDREFS(l,itemType);

    if(adapter!=null)
        l = new AdaptedLister(l,adapter.adapterType);

    return l;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:40,代码来源:Lister.java

示例9: calcId

private ID calcId() {
    if(seed.hasAnnotation(XmlID.class)) {
        // check the type
        if(!getIndividualType().equals(nav().ref(String.class)))
            parent.builder.reportError(new IllegalAnnotationException(
                Messages.ID_MUST_BE_STRING.format(getName()), seed )
            );
        return ID.ID;
    } else
    if(seed.hasAnnotation(XmlIDREF.class)) {
        return ID.IDREF;
    } else {
        return ID.NONE;
    }
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:15,代码来源:PropertyInfoImpl.java

示例10: create

/**
 * Gets a reference to the appropriate {@link Lister} object
 * if the field is a multi-value field. Otherwise null.
 *
 * @param fieldType
 *      the type of the field that stores the collection
 * @param idness
 *      ID-ness of the property.
 * @param adapter
 *      adapter to be used for individual items. can be null.
 */
public static <BeanT,PropT,ItemT,PackT>
    Lister<BeanT,PropT,ItemT,PackT> create(Type fieldType,ID idness, Adapter<Type,Class> adapter) {

    Class rawType = Navigator.REFLECTION.erasure(fieldType);
    Class itemType;

    Lister l;
    if( rawType.isArray() ) {
        itemType = rawType.getComponentType();
        l = getArrayLister(itemType);
    } else
    if( Collection.class.isAssignableFrom(rawType) ) {
        Type bt = Navigator.REFLECTION.getBaseClass(fieldType,Collection.class);
        if(bt instanceof ParameterizedType)
            itemType = Navigator.REFLECTION.erasure(((ParameterizedType)bt).getActualTypeArguments()[0]);
        else
            itemType = Object.class;
        l = new CollectionLister(getImplClass(rawType));
    } else
        return null;

    if(idness==ID.IDREF)
        l = new IDREFS(l,itemType);

    if(adapter!=null)
        l = new AdaptedLister(l,adapter.adapterType);

    return l;
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:40,代码来源:Lister.java


注:本文中的com.sun.xml.internal.bind.v2.model.core.ID.IDREF属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。