Tabnine Logo
JDefinedClass.direct
Code IndexAdd Tabnine 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)

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

  • Making http post requests using okhttp
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (Timer)
  • setScale (BigDecimal)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • BoxLayout (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • PhpStorm for WordPress
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now