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

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

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

  • 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

private boolean extendsParcelable(final JDefinedClass jclass) {
  final java.util.Iterator<JClass> interfaces = jclass._extends() != null ? jclass._extends()._implements() : null;
  if (interfaces != null) {
    while (interfaces.hasNext()) {
      final JClass iface = interfaces.next();
      if (iface.erasure().name().equals("Parcelable")) {
        return true;
      }
    }
  }
  return false;
}
origin: joelittlejohn/jsonschema2pojo

/**
 * This is recursive with searchClassAndSuperClassesForField
 */
private JFieldVar searchSuperClassesForField(String property, JDefinedClass jclass) {
  JClass superClass = jclass._extends();
  JDefinedClass definedSuperClass = definedClassOrNullFromType(superClass);
  if (definedSuperClass == null) {
    return null;
  }
  return searchClassAndSuperClassesForField(property, definedSuperClass);
}
origin: joelittlejohn/jsonschema2pojo

/**
 * Applies this schema rule to take the required code generation steps.
 * <p>
 * For each property present within the properties node, this rule will
 * invoke the 'property' rule provided by the given schema mapper.
 *
 * @param nodeName
 *            the name of the node for which properties are being added
 * @param node
 *            the properties node, containing property names and their
 *            definition
 * @param jclass
 *            the Java type which will have the given properties added
 * @return the given jclass
 */
@Override
public JDefinedClass apply(String nodeName, JsonNode node, JsonNode parent, JDefinedClass jclass, Schema schema) {
  if (node == null) {
    node = JsonNodeFactory.instance.objectNode();
  }
  for (Iterator<String> properties = node.fieldNames(); properties.hasNext(); ) {
    String property = properties.next();
    ruleFactory.getPropertyRule().apply(property, node.get(property), node, jclass, schema);
  }
  if (ruleFactory.getGenerationConfig().isGenerateBuilders() && !jclass._extends().name().equals("Object")) {
    addOverrideBuilders(jclass, jclass.owner()._getClass(jclass._extends().fullName()));
  }
  ruleFactory.getAnnotator().propertyOrder(jclass, node);
  return jclass;
}
origin: joelittlejohn/jsonschema2pojo

if (jclass._extends() != null) {
  dataOutputStream.writeUTF(jclass._extends().fullName());
origin: joelittlejohn/jsonschema2pojo

private JMethod addInternalSetMethodJava7(JDefinedClass jclass, JsonNode propertiesNode) {
  JMethod method = jclass.method(PROTECTED, jclass.owner().BOOLEAN, DEFINED_SETTER_NAME);
  JVar nameParam = method.param(String.class, "name");
  JVar valueParam = method.param(Object.class, "value");
  JBlock body = method.body();
  JSwitch propertySwitch = body._switch(nameParam);
  if (propertiesNode != null) {
    for (Iterator<Map.Entry<String, JsonNode>> properties = propertiesNode.fields(); properties.hasNext();) {
      Map.Entry<String, JsonNode> property = properties.next();
      String propertyName = property.getKey();
      JsonNode node = property.getValue();
      String fieldName = ruleFactory.getNameHelper().getPropertyName(propertyName, node);
      JType propertyType = jclass.fields().get(fieldName).type();
      addSetPropertyCase(jclass, propertySwitch, propertyName, propertyType, valueParam, node);
    }
  }
  JBlock defaultBlock = propertySwitch._default().body();
  JClass extendsType = jclass._extends();
  if (extendsType != null && extendsType instanceof JDefinedClass) {
    JDefinedClass parentClass = (JDefinedClass) extendsType;
    JMethod parentMethod = parentClass.getMethod(DEFINED_SETTER_NAME,
        new JType[] { parentClass.owner()._ref(String.class), parentClass.owner()._ref(Object.class) });
    defaultBlock._return(_super().invoke(parentMethod).arg(nameParam).arg(valueParam));
  } else {
    defaultBlock._return(FALSE);
  }
  return method;
}
origin: joelittlejohn/jsonschema2pojo

private JMethod addInternalGetMethodJava7(JDefinedClass jclass, JsonNode propertiesNode) {
  JMethod method = jclass.method(PROTECTED, jclass.owner()._ref(Object.class), DEFINED_GETTER_NAME);
  JVar nameParam = method.param(String.class, "name");
  JVar notFoundParam = method.param(jclass.owner()._ref(Object.class), "notFoundValue");
  JBlock body = method.body();
  JSwitch propertySwitch = body._switch(nameParam);
  if (propertiesNode != null) {
    for (Iterator<Map.Entry<String, JsonNode>> properties = propertiesNode.fields(); properties.hasNext();) {
      Map.Entry<String, JsonNode> property = properties.next();
      String propertyName = property.getKey();
      JsonNode node = property.getValue();
      String fieldName = ruleFactory.getNameHelper().getPropertyName(propertyName, node);
      JType propertyType = jclass.fields().get(fieldName).type();
      addGetPropertyCase(jclass, propertySwitch, propertyName, propertyType, node);
    }
  }
  JClass extendsType = jclass._extends();
  if (extendsType != null && extendsType instanceof JDefinedClass) {
    JDefinedClass parentClass = (JDefinedClass) extendsType;
    JMethod parentMethod = parentClass.getMethod(DEFINED_GETTER_NAME,
        new JType[] { parentClass.owner()._ref(String.class), parentClass.owner()._ref(Object.class) });
    propertySwitch._default().body()
    ._return(_super().invoke(parentMethod).arg(nameParam).arg(notFoundParam));
  } else {
    propertySwitch._default().body()
    ._return(notFoundParam);
  }
  return method;
}
origin: joelittlejohn/jsonschema2pojo

jclass._extends((JClass) superType);
origin: joelittlejohn/jsonschema2pojo

JClass extendsType = jclass._extends();
JBlock lastBlock = propertyConditional == null ? body : propertyConditional._else();
origin: joelittlejohn/jsonschema2pojo

JClass extendsType = jclass._extends();
JBlock lastBlock = propertyConditional == null ? body : propertyConditional._else();
if (extendsType != null && extendsType instanceof JDefinedClass) {
origin: joelittlejohn/jsonschema2pojo

if (!jclass._extends().fullName().equals(Object.class.getName())) {
  body.assign(result, result.mul(JExpr.lit(31)).plus(JExpr._super().invoke("hashCode")));
origin: joelittlejohn/jsonschema2pojo

if (!jclass._extends().fullName().equals(Object.class.getName())) {
  result = result.cand(JExpr._super().invoke("equals").arg(rhsVar));
origin: joelittlejohn/jsonschema2pojo

if (!jclass._extends().fullName().equals(Object.class.getName())) {
  JVar baseLength = body.decl(jclass.owner().INT, "baseLength", sb.invoke("length"));
  JVar superString = body.decl(jclass.owner().ref(String.class), "superString", JExpr._super().invoke("toString"));
origin: javaee/glassfish

  injector._extends(cm.ref(NoopConfigInjector.class));
  injectAttributeMethod = null;
  injectMethod = null;
  injectElementMethod = null;
} else {
  injector._extends(cm.ref(ConfigInjector.class).narrow(targetType));
origin: e-biz/androidkickstartr

public JCodeModel generate(JCodeModel jCodeModel, RefHelper ref) throws IOException {
  logger = LoggerFactory.getLogger(getClass());
  try {
    jClass = jCodeModel._class(appDetails.getApplicationPackage());
    jClass._extends(ref.application());
    jClass.annotate(ref.reportsCrashes()).param("formKey", "YOUR_FORM_KEY");
    JMethod onCreateMethod = jClass.method(JMod.PUBLIC, jCodeModel.VOID, "onCreate");
    onCreateMethod.annotate(ref.override());
    JBlock onCreateMethodBody = onCreateMethod.body();
    onCreateMethodBody.staticInvoke(ref.acra(), "init").arg(JExpr._this());
    onCreateMethodBody.invoke(JExpr._super(), "onCreate");
  } catch (JClassAlreadyExistsException e1) {
    logger.error("Classname already exists", e1);
  }
  return jCodeModel;
}
origin: org.jsonschema2pojo/jsonschema2pojo-core

private boolean extendsParcelable(final JDefinedClass jclass) {
  final java.util.Iterator<JClass> interfaces = jclass._extends() != null ? jclass._extends()._implements() : null;
  if (interfaces != null) {
    while (interfaces.hasNext()) {
      final JClass iface = interfaces.next();
      if (iface.erasure().name().equals("Parcelable")) {
        return true;
      }
    }
  }
  return false;
}
origin: org.jsonschema2pojo/jsonschema2pojo-core

/**
 * This is recursive with searchClassAndSuperClassesForField
 */
private JFieldVar searchSuperClassesForField(String property, JDefinedClass jclass) {
  JClass superClass = jclass._extends();
  JDefinedClass definedSuperClass = definedClassOrNullFromType(superClass);
  if (definedSuperClass == null) {
    return null;
  }
  return searchClassAndSuperClassesForField(property, definedSuperClass);
}
origin: e-biz/androidkickstartr

private void createActivity() {
  JClass parentActivity;
  if (appDetails.isRoboguice() && appDetails.isActionBarSherlock()) {
    if (appDetails.isViewPager()) {
      parentActivity = ref.ref(appDetails.getRoboSherlockFragmentActivityPackage());
    } else {
      parentActivity = ref.ref(appDetails.getRoboSherlockActivityPackage());
    }
  } else if (appDetails.isActionBarSherlock()) {
    parentActivity = appDetails.isViewPager() ? ref.sFragmentActivity() : ref.sActivity();
  } else if (appDetails.isRoboguice()) {
    parentActivity = appDetails.isViewPager() ? ref.roboFragmentActivity() : ref.roboActivity();
  } else {
    parentActivity = appDetails.isViewPager() ? ref.fragmentActivity() : ref.activity();
  }
  jClass._extends(parentActivity);
  // @EActivity
  if (appDetails.isAndroidAnnotations()) {
    JAnnotationUse eactivityAnnotation = jClass.annotate(ref.eactivity());
    JFieldRef field = ref.r().staticRef("layout").ref(appDetails.getActivityLayout());
    eactivityAnnotation.param("value", field);
  }
}
origin: e-biz/androidkickstartr

  jClass._extends(ref.ref(appDetails.getRoboSherlockFragmentPackage()));
} else if (appDetails.isRoboguice()) {
  jClass._extends(ref.roboFragment());
} else {
  jClass._extends(ref.fragment());
origin: e-biz/androidkickstartr

jClass._extends(ref.fragmentPagerAdapter());
origin: jpmml/jpmml-evaluator

private void createReportingVectorClass(JCodeModel codeModel, String name, JPrimitiveType type) throws JClassAlreadyExistsException {
  JDefinedClass clazz = codeModel._class(JMod.ABSTRACT | JMod.PUBLIC, "org.jpmml.evaluator.Reporting" + name, ClassType.CLASS);
  clazz._extends(codeModel.ref("org.jpmml.evaluator." + name));
  JFieldVar expressionField = clazz.field(JMod.PRIVATE, String.class, "expression", JExpr.lit(""));
  createNewReportMethod(clazz);
  createOperationMethods(clazz, name, type);
  createValueMethods(clazz, type);
  createReportMethod(clazz);
  createAccessorMethods(clazz, expressionField);
}
com.sun.codemodelJDefinedClass_extends

Javadoc

Returns the class extended by this class.

Popular methods of JDefinedClass

  • method
  • 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
  • _class
    Add a new public nested class to this class.
  • javadoc,
  • _class,
  • getMethod,
  • _package,
  • dotclass,
  • enumConstant,
  • staticInvoke,
  • staticRef,
  • 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