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

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

Best Java code snippets using com.sun.codemodel.JDefinedClass.direct (Showing top 9 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: e-biz/androidkickstartr

jClass.direct("@Override\n " + //
    "public void onTabUnselected(Tab tab, FragmentTransaction ft) {}");
jClass.direct("@Override\n" + //
    "public void onTabReselected(Tab tab, FragmentTransaction ft) {}");
origin: e-biz/androidkickstartr

jClass.direct("@Override\n" + //
    "public void onPageScrollStateChanged(int position) {}");
jClass.direct("@Override\n" + //
    " public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {}");
origin: org.andromda.thirdparty.jaxb2_commons/simple-regenerator

public boolean run(Outline model, Options opt, ErrorHandler errorHandler) throws SAXException {
  
  File javaFile = null;
  try {
  
    for(ClassOutline co : model.getClasses()) {
      javaFile = new File(opt.targetDir, co.target.fullName().replaceAll("\\.", "/") + ".java");
      //System.out.println("simple_regenerator: [" 
        //+ javaFile.getAbsolutePath() + "] " + (javaFile.canRead() ? "exists" : "non-existing"));
      
      if(!javaFile.canWrite())
        continue;
      
      String preservedCode = getPreservedCode(javaFile);
      if(preservedCode != null) {
        System.out.println("simple_regenerator: preserved code in: [" + javaFile.getAbsolutePath() + "]");
        co.implClass.direct(preservedCode);
      }
    }

    return true;
  }
  catch(Exception e) {
    errorHandler.error(new SAXParseException("Failed to write to "+ javaFile, null, e));
    return false;
  }
}
 
origin: uk.org.retep.tools/jaxb

private void inject( final Context ctx, final File templateFile )
    throws SAXException
{
  info( "Injecting " + templateFile + " to " + ctx.definedClass.fullName() );
  try
  {
    final StringBuilder text = FileUtils.read( templateFile );
    // Remove everthing outside the outer {...} inclusive
    text.delete( 0, text.indexOf( "{" ) + 1 );
    text.delete( text.lastIndexOf( "}" ), text.length() );
    // Add comments either side of the injected source
    text.insert( 0,
           "\n\t// ========== Start of injected source ==========\n\n" );
    text.append(
        "\n\t// ========== End of injected source ==========\n\n" );
    ctx.definedClass.direct( text.toString() );
  }
  catch( FileNotFoundException fnfe )
  {
    // Just log the fact, no stacktrace
    fail( "Failed to locate template " + templateFile );
  }
  catch( Exception ex )
  {
    // catch everything else with a stacktrace
    fail( "failed to read template " + templateFile, ex );
  }
}
origin: org.andromda.thirdparty.jaxb2_commons/jaxb-xjc

  public boolean run(Outline model, Options opt, ErrorHandler errorHandler) {
    for( ClassOutline co : model.getClasses() ) {
      CPluginCustomization c = co.target.getCustomizations().find(Const.NS,"code");
      if(c==null)
        continue;   // no customization --- nothing to inject here

      c.markAsAcknowledged();
      // TODO: ideally you should validate this DOM element to make sure
      // that there's no typo/etc. JAXP 1.3 can do this very easily.
      String codeFragment = DOMUtils.getElementText(c.element);

      // inject the specified code fragment into the implementation class.
      co.implClass.direct(codeFragment);
    }

    return true;
  }
}
origin: sun-jaxb/jaxb-xjc

  public boolean run(Outline model, Options opt, ErrorHandler errorHandler) {
    for( ClassOutline co : model.getClasses() ) {
      CPluginCustomization c = co.target.getCustomizations().find(Const.NS,"code");
      if(c==null)
        continue;   // no customization --- nothing to inject here

      c.markAsAcknowledged();
      // TODO: ideally you should validate this DOM element to make sure
      // that there's no typo/etc. JAXP 1.3 can do this very easily.
      String codeFragment = DOMUtils.getElementText(c.element);

      // inject the specified code fragment into the implementation class.
      co.implClass.direct(codeFragment);
    }

    return true;
  }
}
origin: apache/servicemix-bundles

  private static void checkAndInject(Collection<? extends CustomizableOutline> outlines) {
    for (CustomizableOutline co : outlines) {
      CPluginCustomization c = co.getTarget().getCustomizations().find(Const.NS, "code");
      if(c==null)
        continue;   // no customization --- nothing to inject here

      c.markAsAcknowledged();
      // TODO: ideally you should validate this DOM element to make sure
      // that there's no typo/etc. JAXP 1.3 can do this very easily.
      String codeFragment = DOMUtils.getElementText(c.element);

      // inject the specified code fragment into the implementation class.
      co.getImplClass().direct(codeFragment);
    }
  }
}
origin: org.glassfish.metro/webservices-tools

  private static void checkAndInject(Collection<? extends CustomizableOutline> outlines) {
    for (CustomizableOutline co : outlines) {
      CPluginCustomization c = co.getTarget().getCustomizations().find(Const.NS, "code");
      if(c==null)
        continue;   // no customization --- nothing to inject here

      c.markAsAcknowledged();
      // TODO: ideally you should validate this DOM element to make sure
      // that there's no typo/etc. JAXP 1.3 can do this very easily.
      String codeFragment = DOMUtils.getElementText(c.element);

      // inject the specified code fragment into the implementation class.
      co.getImplClass().direct(codeFragment);
    }
  }
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxb-xjc

  private static void checkAndInject(Collection<? extends CustomizableOutline> outlines) {
    for (CustomizableOutline co : outlines) {
      CPluginCustomization c = co.getTarget().getCustomizations().find(Const.NS, "code");
      if(c==null)
        continue;   // no customization --- nothing to inject here

      c.markAsAcknowledged();
      // TODO: ideally you should validate this DOM element to make sure
      // that there's no typo/etc. JAXP 1.3 can do this very easily.
      String codeFragment = DOMUtils.getElementText(c.element);

      // inject the specified code fragment into the implementation class.
      co.getImplClass().direct(codeFragment);
    }
  }
}
com.sun.codemodelJDefinedClassdirect

Javadoc

Places the given string directly inside the generated class. This method can be used to add methods/fields that are not generated by CodeModel. This method should be used only as the last resort.

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,
  • staticRef,
  • init

Popular in Java

  • Reading from database using SQL prepared statement
  • getApplicationContext (Context)
  • compareTo (BigDecimal)
  • onRequestPermissionsResult (Fragment)
  • BufferedReader (java.io)
    Reads text from a character-input stream, buffering characters so as to provide for the efficient re
  • URLConnection (java.net)
    The abstract class URLConnection is the superclass of all classes that represent a communications li
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • DecimalFormat (java.text)
    DecimalFormat is a concrete subclass ofNumberFormat that formats decimal numbers. It has a variety o
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
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