Codota Logo
JDefinedClass.staticRef
Code IndexAdd Codota to your IDE (free)

How to use
staticRef
method
in
com.sun.codemodel.JDefinedClass

Best Java code snippets using com.sun.codemodel.JDefinedClass.staticRef (Showing top 20 results out of 315)

  • Common ways to obtain JDefinedClass
private void myMethod () {
JDefinedClass j =
  • Codota IconJCodeModel codeModel;String fullyqualifiedName;codeModel._class(fullyqualifiedName)
  • Codota IconJClassAlreadyExistsException e;e.getExistingClass()
  • Codota IconJCodeModel cm;String fullyqualifiedName;ClassType t;cm._class(fullyqualifiedName, t)
  • Smart code suggestions by Codota
}
origin: joelittlejohn/jsonschema2pojo

JFieldRef getOrAddNotFoundVar(JDefinedClass jclass) {
  jclass.field(PROTECTED | STATIC | FINAL, Object.class, NOT_FOUND_VALUE_FIELD,
      _new(jclass.owner()._ref(Object.class)));
  return jclass.staticRef(NOT_FOUND_VALUE_FIELD);
}
origin: com.sap.cloud.yaas.rammler/rammler-core

private JFieldRef createUriParamConstants(final JDefinedClass builder, final String uriParamName)
{
  return builder.staticRef(uriParamName);
}
origin: org.jvnet.jaxb2_commons/jaxb2-basics-tools

public void get(JBlock block, JVar variable) {
  block.assign(variable, ConstantPropertyOutline.this.referenceClass
      .staticRef(ConstantPropertyOutline.this.field));
}
origin: com.googlecode.androidannotations/androidannotations

JExpression activityRef = holder.generatedClass.staticRef("this");
JInvocation onResultInvocation = onActivityResultCase.invoke(activityRef, methodName);
origin: io.konig/konig-schemagen

private void createTypeGetter(JCodeModel model, TypeInfo pair) {
  
  JClass setClass = model.ref(Set.class);
  JClass uriSetClass = setClass.narrow(URI.class);
  
  JDefinedClass dc = pair.implClass;
  JFieldRef typeRef = pair.interfaceClass.staticRef("TYPE");
  JMethod method = dc.method(JMod.PUBLIC, URI.class, "getType");
  method.body()._return(typeRef);
  
  JFieldRef typeSetField = pair.interfaceClass.staticRef("TYPES");
  
  dc.method(JMod.PUBLIC, uriSetClass, "getAllTypes")
    .body()._return(typeSetField);
}
 
origin: org.jsonschema2pojo/jsonschema2pojo-core

JFieldRef getOrAddNotFoundVar(JDefinedClass jclass) {
  jclass.field(PROTECTED | STATIC | FINAL, Object.class, NOT_FOUND_VALUE_FIELD,
      _new(jclass.owner()._ref(Object.class)));
  return jclass.staticRef(NOT_FOUND_VALUE_FIELD);
}
origin: org.metatype.sxc/sxc-jaxb

public JFieldRef getAdapter(Class adapterType) {
  String adapterId = adapterType.getName();
  JFieldRef ref = adapters.get(adapterId);
  if (ref == null) {
    final String fieldName = decapitalize(adapterType.getSimpleName()) + "Adapter";
    final JPackage jPackage = jaxbObjectClass.getPackage();
    final JDefinedClass definedClass;
    if (jPackage._getClass("Adapters") != null) {
      definedClass = jPackage._getClass("Adapters");
      if (!definedClass.fields().containsKey(fieldName)) {
        JClass jClass = builderContext.toJClass(adapterType);
        definedClass.field(JMod.PUBLIC | JMod.STATIC | JMod.FINAL, jClass, fieldName, JExpr._new(jClass));
      }
    } else {
      try {
        definedClass = jPackage._class("Adapters");
        JClass jClass = builderContext.toJClass(adapterType);
        definedClass.field(JMod.PUBLIC | JMod.STATIC | JMod.FINAL, jClass, fieldName, JExpr._new(jClass));
      } catch (JClassAlreadyExistsException e) {
        throw new IllegalStateException(e);
      }
    }
    ref = definedClass.staticRef(fieldName);
    adapters.put(adapterId, ref);
  }
  return ref;
}
origin: io.konig/konig-schemagen

JFieldRef typeField = typeInfo.interfaceClass.staticRef("TYPE");
    JFieldRef thingTypeField = owlThing.interfaceClass.staticRef("TYPE");
    init = init.invoke("append").arg(thingTypeField);
  } else {
    for (TypeInfo superType : superList) {
      JFieldRef superTypeField = superType.interfaceClass.staticRef("TYPES");
      init = init.invoke("appendAll").arg(superTypeField);
origin: com.googlecode.androidannotations/androidannotations

JExpression activityRef = holder.generatedClass.staticRef("this");
textChangeCall = methodBody.invoke(activityRef, methodName);
origin: com.googlecode.androidannotations/androidannotations

@Override
public void process(Element element, JCodeModel codeModel, EBeanHolder holder) {
  String methodName = element.getSimpleName().toString();
  List<JFieldRef> idsRefs = helper.extractAnnotationFieldRefs(holder, element, Res.ID, true);
  for (JFieldRef idRef : idsRefs) {
    OnSeekBarChangeListenerHolder onSeekBarChangeListenerHolder = helper.getOrCreateListener(codeModel, holder, idRef);
    JInvocation textChangeCall;
    JMethod methodToCall = getMethodToCall(onSeekBarChangeListenerHolder);
    JBlock previousBody = codeModelHelper.removeBody(methodToCall);
    JBlock methodBody = methodToCall.body();
    methodBody.add(previousBody);
    JExpression activityRef = holder.generatedClass.staticRef("this");
    textChangeCall = methodBody.invoke(activityRef, methodName);
    ExecutableElement executableElement = (ExecutableElement) element;
    List<? extends VariableElement> parameters = executableElement.getParameters();
    if (parameters.size() == 1) {
      JVar progressParameter = codeModelHelper.findParameterByName(methodToCall, "seekBar");
      textChangeCall.arg(progressParameter);
    }
  }
}
origin: com.googlecode.androidannotations/androidannotations

public void callSuperMethod(JMethod superMethod, EBeanHolder holder, JBlock callBlock) {
  JExpression activitySuper = holder.generatedClass.staticRef("super");
  JInvocation superCall = JExpr.invoke(activitySuper, superMethod);
  for (JVar param : superMethod.params()) {
    superCall.arg(param);
  }
  JType returnType = superMethod.type();
  if (returnType.fullName().equals("void")) {
    callBlock.add(superCall);
  } else {
    callBlock._return(superCall);
  }
}
origin: Evolveum/midpoint

body._return(definedClass.staticRef(COMPLEX_TYPE_FIELD_NAME));
origin: com.googlecode.androidannotations/androidannotations

JExpression activityRef = holder.generatedClass.staticRef("this");
JInvocation call = JExpr.invoke(activityRef, methodName);
origin: com.googlecode.androidannotations/androidannotations

@Override
public void process(Element element, JCodeModel codeModel, EBeanHolder holder) {
  Classes classes = holder.classes();
  String methodName = element.getSimpleName().toString();
  ExecutableElement executableElement = (ExecutableElement) element;
  List<? extends VariableElement> parameters = executableElement.getParameters();
  boolean hasViewParameter = parameters.size() == 1;
  List<JFieldRef> idsRefs = helper.extractAnnotationFieldRefs(holder, element, getTarget(), rClass.get(Res.ID), true);
  JDefinedClass onClickListenerClass = codeModel.anonymousClass(classes.VIEW_ON_CLICK_LISTENER);
  JMethod onClickMethod = onClickListenerClass.method(JMod.PUBLIC, codeModel.VOID, "onClick");
  onClickMethod.annotate(Override.class);
  JVar onClickViewParam = onClickMethod.param(classes.VIEW, "view");
  JExpression activityRef = holder.generatedClass.staticRef("this");
  JInvocation clickCall = onClickMethod.body().invoke(activityRef, methodName);
  if (hasViewParameter) {
    clickCall.arg(onClickViewParam);
  }
  for (JFieldRef idRef : idsRefs) {
    JBlock block = holder.afterSetContentView.body().block();
    JInvocation findViewById = invoke("findViewById");
    JVar view = block.decl(classes.VIEW, "view", findViewById.arg(idRef));
    block._if(view.ne(_null()))._then().invoke(view, "setOnClickListener").arg(_new(onClickListenerClass));
  }
}
origin: org.kuali.rice/rice-development-tools

private void renderClassLevelAnnotations(JDefinedClass classModel, List<FieldModel> fields) throws Exception {
  JFieldRef constantsClass = classModel.staticRef(Util.CONSTANTS_CLASS_NAME);
  JFieldRef elementsClass = classModel.staticRef(Util.ELEMENTS_CLASS_NAME);
  JClass coreConstants = codeModel.ref(CoreConstants.class);
  JFieldRef commonElementsRef = coreConstants.staticRef("CommonElements");
  
  // XmlRootElement
  JAnnotationUse rootElementAnnotation = classModel.annotate(XmlRootElement.class);
  rootElementAnnotation.param("name", constantsClass.ref(Util.ROOT_ELEMENT_NAME_FIELD));
  
  // XmlAccessorType
  JAnnotationUse xmlAccessorTypeAnnotation = classModel.annotate(XmlAccessorType.class);
  xmlAccessorTypeAnnotation.param("value", XmlAccessType.NONE);
  
  // XmlType
  JAnnotationUse xmlTypeAnnotation = classModel.annotate(XmlType.class);
  xmlTypeAnnotation.param("name", constantsClass.ref(Util.TYPE_NAME_FIELD));
  JAnnotationArrayMember propOrderMember = xmlTypeAnnotation.paramArray("propOrder");
  for (FieldModel field : fields) {
    if (Util.isCommonElement(field.fieldName)) {
      propOrderMember.param(commonElementsRef.ref(Util.toConstantsVariable(field.fieldName)));
    } else {
      propOrderMember.param(elementsClass.ref(Util.toConstantsVariable(field.fieldName)));
    }
  }
  propOrderMember.param(commonElementsRef.ref("FUTURE_ELEMENTS"));
}

origin: org.brightify.torch/torch-compiler

@Override
public JStatement unmarshall(EntityDescriptionGenerator.CreateFromRawEntityHolder holder,
               PropertyMirror propertyMirror) {
  JExpression relation = holder.torchFactory
      .invoke("getRelationResolver")
      .invoke("with").arg(CodeModelTypes.ref(holder.classHolder.entityMirror.getFullName()).dotclass())
      .invoke("onProperty").arg(holder.classHolder.definedClass.staticRef(propertyMirror.getName()))
      .invoke("parentId").arg(holder.classHolder.entityMirror.getIdPropertyMirror().getGetter().getValue(
          holder.entity));
  return propertyMirror.getSetter().setValue(holder.entity, relation);
}
origin: com.googlecode.androidannotations/androidannotations

JExpression activitySuper = holder.generatedClass.staticRef("super");
JInvocation superCall = JExpr.invoke(activitySuper, method);
origin: fusesource/fuse-extra

private void addFieldWrite(Attribute attribute, JBlock body) {
  if ( attribute.attribute.type().isArray() ) {
    body.staticInvoke(cm.ref("AMQPArray"), "write").arg(_this().ref(attribute.attribute.name())).arg(ref("out"));
  } else if ( generator.getMapping().get(attribute.type) != null ) {
    body.staticInvoke(cm.ref(generator.getPrimitiveJavaClass().get(attribute.type)), "write").arg(_this().ref(attribute.attribute.name())).arg(ref("out"));
  } else {
    JConditional conditional = body
        ._if(ref(attribute.attribute.name()).ne(_null()));
    conditional._then()
        .invoke(ref(attribute.attribute.name()), "write").arg(ref("out"));
    conditional._else().invoke(ref("out"), "writeByte").arg(generator.registry().cls().staticRef("NULL_FORMAT_CODE"));
  }
}
origin: com.envoisolutions.sxc/sxc-jaxb

lifecycleCallbackRef = builder.getJAXBObjectClass().staticRef(builder.getLifecycleCallbackVar().name());
origin: org.metatype.sxc/sxc-jaxb

JFieldVar fieldVar = (JFieldVar) lifecycleCallbackRef;
if (builder.getWriteVariableManager().containsId(fieldVar.name())) {
  lifecycleCallbackRef = builder.getJAXBObjectClass().staticRef(fieldVar.name());
com.sun.codemodelJDefinedClassstaticRef

Popular methods of JDefinedClass

  • method
  • _extends
  • field
  • _implements
  • name
    JClass name accessor. For example, for java.util.List, this method returns "List""
  • constructor
    Adds a constructor to this class.
  • fields
    Returns all the fields declred in this class. The returned Map is a read-only live view.
  • annotate
    Adding ability to annotate a class
  • fullName
    Gets the fully qualified name of this class.
  • methods
  • owner
  • javadoc
    Creates, if necessary, and returns the class javadoc for this JDefinedClass
  • owner,
  • javadoc,
  • _class,
  • getMethod,
  • _package,
  • dotclass,
  • enumConstant,
  • staticInvoke,
  • init

Popular in Java

  • Updating database using SQL prepared statement
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setContentView (Activity)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • JOptionPane (javax.swing)
  • LogFactory (org.apache.commons.logging)
    A minimal incarnation of Apache Commons Logging's LogFactory API, providing just the common Log look
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registery of org.quartz
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now