• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Aspect类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.tools.internal.xjc.outline.Aspect的典型用法代码示例。如果您正苦于以下问题:Java Aspect类的具体用法?Java Aspect怎么用?Java Aspect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Aspect类属于com.sun.tools.internal.xjc.outline包,在下文中一共展示了Aspect类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getUsedPackages

import com.sun.tools.internal.xjc.outline.Aspect; //导入依赖的package包/类
/**
 * Returns all <i>used</i> JPackages.
 *
 * A JPackage is considered as "used" if a ClassItem or
 * a InterfaceItem resides in that package.
 *
 * This value is dynamically calculated every time because
 * one can freely remove ClassItem/InterfaceItem.
 *
 * @return
 *         Given the same input, the order of packages in the array
 *         is always the same regardless of the environment.
 */
public final JPackage[] getUsedPackages(Aspect aspect) {
    Set<JPackage> s = new TreeSet<JPackage>();

    for (CClassInfo bean : model.beans().values()) {
        JClassContainer cont = getContainer(bean.parent(), aspect);
        if (cont.isPackage()) {
            s.add((JPackage) cont);
        }
    }

    for (CElementInfo e : model.getElementMappings(null).values()) {
        // at the first glance you might think we should be iterating all elements,
        // not just global ones, but if you think about it, local ones live inside
        // another class, so those packages are already enumerated when we were
        // walking over CClassInfos.
        s.add(e._package());
    }

    return s.toArray(new JPackage[s.size()]);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:BeanGenerator.java


示例2: getRef

import com.sun.tools.internal.xjc.outline.Aspect; //导入依赖的package包/类
static NClass getRef( final Class<? extends XmlAdapter> adapter, boolean copy ) {
    if(copy) {
        // TODO: this is a hack. the code generation should be defered until
        // the backend. (right now constant generation happens in the front-end)
        return new EagerNClass(adapter) {
            @Override
            public JClass toType(Outline o, Aspect aspect) {
                return o.addRuntime(adapter);
            }
            public String fullName() {
                // TODO: implement this method later
                throw new UnsupportedOperationException();
            }
        };
    } else {
        return NavigatorImpl.theInstance.ref(adapter);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:CAdapter.java


示例3: AbstractField

import com.sun.tools.internal.xjc.outline.Aspect; //导入依赖的package包/类
protected AbstractField( ClassOutlineImpl outline, CPropertyInfo prop ) {
    this.outline = outline;
    this.prop = prop;
    this.codeModel = outline.parent().getCodeModel();
    this.implType = getType(IMPLEMENTATION);
    this.exposedType = getType(Aspect.EXPOSED);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:AbstractField.java


示例4: listPossibleTypes

import com.sun.tools.internal.xjc.outline.Aspect; //导入依赖的package包/类
/**
 * Returns contents to be added to javadoc.
 */
protected final List<Object> listPossibleTypes( CPropertyInfo prop ) {
    List<Object> r = new ArrayList<Object>();
    for( CTypeInfo tt : prop.ref() ) {
        JType t = tt.getType().toType(outline.parent(),Aspect.EXPOSED);
        if( t.isPrimitive() || t.isArray() )
            r.add(t.fullName());
        else {
            r.add(t);
            r.add("\n");
        }
    }

    return r;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:AbstractField.java


示例5: toRawValue

import com.sun.tools.internal.xjc.outline.Aspect; //导入依赖的package包/类
public void toRawValue(JBlock block, JVar $var) {
    // [RESULT]
    // $<var>.addAll(bean.getLIST());
    // list.toArray( array );
    block.assign($var,JExpr._new(codeModel.ref(ArrayList.class).narrow(getType(Aspect.EXPOSED).boxify())).arg(
        $target.invoke($get)
    ));
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:NoExtendedContentField.java


示例6: getType

import com.sun.tools.internal.xjc.outline.Aspect; //导入依赖的package包/类
@Override
protected JType getType(final Aspect aspect) {
    if (Aspect.IMPLEMENTATION.equals(aspect)) {
        return super.getType(aspect);
    }

    if (prop instanceof CReferencePropertyInfo) {
        Set<CElement> elements = ((CReferencePropertyInfo)prop).getElements();
        if ((elements != null) && (elements.size() > 0)) {
            return codeModel.ref(Serializable.class);
        }
    }

    return codeModel.ref(String.class);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:NoExtendedContentField.java


示例7: getType

import com.sun.tools.internal.xjc.outline.Aspect; //导入依赖的package包/类
@Override
protected JType getType(final Aspect aspect) {
    if (Aspect.IMPLEMENTATION.equals(aspect)) {
        return super.getType(aspect);
    }
    return codeModel.ref(Serializable.class);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:ContentListField.java


示例8: getContainer

import com.sun.tools.internal.xjc.outline.Aspect; //导入依赖的package包/类
public JClassContainer getContainer(CClassInfoParent parent, Aspect aspect) {
    CClassInfoParent.Visitor<JClassContainer> v;
    switch (aspect) {
        case EXPOSED:
            v = exposedContainerBuilder;
            break;
        case IMPLEMENTATION:
            v = implContainerBuilder;
            break;
        default:
            assert false;
            throw new IllegalStateException();
    }
    return parent.accept(v);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:16,代码来源:BeanGenerator.java


示例9: addRuntime

import com.sun.tools.internal.xjc.outline.Aspect; //导入依赖的package包/类
public final JClass addRuntime(Class clazz) {
    JClass g = generatedRuntime.get(clazz);
    if (g == null) {
        // put code into a separate package to avoid name conflicts.
        JPackage implPkg = getUsedPackages(Aspect.IMPLEMENTATION)[0].subPackage("runtime");
        g = generateStaticClass(clazz, implPkg);
        generatedRuntime.put(clazz, g);
    }
    return g;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:BeanGenerator.java


示例10: ElementOutlineImpl

import com.sun.tools.internal.xjc.outline.Aspect; //导入依赖的package包/类
ElementOutlineImpl(BeanGenerator parent, CElementInfo ei) {
    super(ei,
          parent.getClassFactory().createClass(
                  parent.getContainer( ei.parent, Aspect.EXPOSED ), ei.shortName(), ei.getLocator() ));
    this.parent = parent;
    parent.elements.put(ei,this);

    JCodeModel cm = parent.getCodeModel();

    implClass._extends(
        cm.ref(JAXBElement.class).narrow(
            target.getContentInMemoryType().toType(parent,Aspect.EXPOSED).boxify()));

    if(ei.hasClass()) {
        JType implType = ei.getContentInMemoryType().toType(parent,Aspect.IMPLEMENTATION);
        JExpression declaredType = JExpr.cast(cm.ref(Class.class),implType.boxify().dotclass()); // why do we have to cast?
        JClass scope=null;
        if(ei.getScope()!=null)
            scope = parent.getClazz(ei.getScope()).implRef;
        JExpression scopeClass = scope==null?JExpr._null():scope.dotclass();
        JFieldVar valField = implClass.field(JMod.PROTECTED|JMod.FINAL|JMod.STATIC,QName.class,"NAME",createQName(cm,ei.getElementName()));

        // take this opportunity to generate a constructor in the element class
        JMethod cons = implClass.constructor(JMod.PUBLIC);
        cons.body().invoke("super")
            .arg(valField)
            .arg(declaredType)
            .arg(scopeClass)
            .arg(cons.param(implType,"value"));

        // generate no-arg constructor in the element class (bug #391; section 5.6.2 in JAXB spec 2.1)
        JMethod noArgCons = implClass.constructor(JMod.PUBLIC);
        noArgCons.body().invoke("super")
            .arg(valField)
            .arg(declaredType)
            .arg(scopeClass)
            .arg(JExpr._null());

    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:ElementOutlineImpl.java


示例11: createConstant

import com.sun.tools.internal.xjc.outline.Aspect; //导入依赖的package包/类
public JExpression createConstant(Outline outline, XmlString literal) {
    // correctly identifying which constant it maps to is hard, so
    // here I'm cheating
    JClass type = toType(outline,Aspect.EXPOSED);
    for (CEnumConstant mem : members) {
        if(mem.getLexicalValue().equals(literal.value))
            return type.staticRef(mem.getName());
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:CEnumLeafInfo.java


示例12: toType

import com.sun.tools.internal.xjc.outline.Aspect; //导入依赖的package包/类
public final JClass toType(Outline o, Aspect aspect) {
    switch(aspect) {
    case IMPLEMENTATION:
        return o.getClazz(this).implRef;
    case EXPOSED:
        return o.getClazz(this).ref;
    default:
        throw new IllegalStateException();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:CClassInfo.java


示例13: toType

import com.sun.tools.internal.xjc.outline.Aspect; //导入依赖的package包/类
public JClass toType(Outline o, Aspect aspect) {
    JClass r = rawType.toType(o,aspect);

    for( NType arg : args )
        r = r.narrow(arg.toType(o,aspect).boxify());

    return r;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:NParameterizedType.java


示例14: toType

import com.sun.tools.internal.xjc.outline.Aspect; //导入依赖的package包/类
public JType toType(Outline o, Aspect aspect) {
    try {
        return o.getCodeModel().parseType(t.toString());
    } catch (ClassNotFoundException e) {
        throw new NoClassDefFoundError(e.getMessage());
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:EagerNType.java



注:本文中的com.sun.tools.internal.xjc.outline.Aspect类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClusterId类代码示例发布时间:2022-05-23
下一篇:
Java DDefine类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap