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

Java Type类代码示例

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

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



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

示例1: generate

import com.google.gwt.core.ext.TreeLogger.Type; //导入依赖的package包/类
@Override public String generate(TreeLogger logger, GeneratorContext context, String typeName) throws UnableToCompleteException {	
String result = null;
try {
	String version = findVersion(logger, context);
	JClassType classType = context.getTypeOracle().getType(typeName);
	String packageName = packageNameFrom(classType);
	String simpleName = simpleNameFrom(classType);
	result = packageName + '.' + simpleName;
	SourceWriter source = getSourceWriter(logger, context, classType); 
	if(source != null) { //? Otherwise, work needs to be done.
	    source.println();
	    source.println("private String value;");
	    source.println();
	    source.println("public " + simpleName + "() {");
	    populateInstanceFactory(logger, context, typeName, source, version);
	    source.println("}");
	    source.println();
	    source.println("@Override");
	    source.println("public String getValue() {");
	    source.println(" return value;");
	    source.println("}");
	    source.println(); source.commit(logger);
	    //emitVersionArtifact(logger, context, version);
    }
} catch (NotFoundException nfe) {
    logger.log(Type.ERROR, "Could not find extension point type '" + typeName + "'!", nfe);
    throw new UnableToCompleteException();
} 
return result;
  }
 
开发者ID:TOMOTON,项目名称:gwt-dagger2,代码行数:31,代码来源:VersionGenerator.java


示例2: findVersion

import com.google.gwt.core.ext.TreeLogger.Type; //导入依赖的package包/类
@SuppressWarnings("resource")
private String findVersion(TreeLogger logger, GeneratorContext context) throws UnableToCompleteException {
   	String result = "0.0.0-DEV";
   	Scanner scanner = null;
   	try {
		URL location = Version.class.getClassLoader().getResource("VERSION");
		scanner = new Scanner(location.openStream(), "UTF-8").useDelimiter("\\A");
		result = scanner.next();
	} catch (IOException ioe) {
	    logger.log(Type.ERROR, "Could not determine build version!", ioe);
	    throw new UnableToCompleteException();
	} finally {
		try { scanner.close(); } catch (Exception ignore) {}
	}
   	return result;
   }
 
开发者ID:TOMOTON,项目名称:gwt-dagger2,代码行数:17,代码来源:VersionGenerator.java


示例3: findReflectedClasses

import com.google.gwt.core.ext.TreeLogger.Type; //导入依赖的package包/类
protected Set<JType> findReflectedClasses(final GeneratorContext context, final TypeOracle typeOracle,
        final TreeLogger logger) throws UnableToCompleteException {
    final Set<JType> types = new HashSet<JType>();
    final Set<String> uediInterfaceNames = getUediInterfaceNames();
    final Set<JClassType> uediInterfaces = new HashSet<JClassType>();
    final String rootPackage = getRootPackage(context, logger);

    for (final JPackage jPackage : typeOracle.getPackages()) {
        for (final JClassType jType : jPackage.getTypes()) {
            if (uediInterfaceNames.contains(jType.getQualifiedSourceName())) {
                uediInterfaces.add(jType);
            } else if (jType.isClass() != null && jType.isInterface() == null && !jType.isClass().isAbstract()
                    && jType.getQualifiedSourceName().startsWith(rootPackage)) {
                types.add(jType);
            }
        }
    }
    if (uediInterfaces.size() < uediInterfaceNames.size()) {
        logger.log(Type.ERROR, "UEDIT: Unable to find UEDI interfaces in classpath. Aborting.");
        throw new UnableToCompleteException();
    }
    return filter(types, uediInterfaces);
}
 
开发者ID:czyzby,项目名称:uedi,代码行数:24,代码来源:ReflectionPoolGenerator.java


示例4: addAnnotations_AnnotationImpl

import com.google.gwt.core.ext.TreeLogger.Type; //导入依赖的package包/类
public static void addAnnotations_AnnotationImpl(TypeOracle typeOracle,
    String dest, SourceWriter source, Annotation[] annotations, TreeLogger logger){

  if (annotations.length <= 0)
	  return;
	
  for (Annotation annotation : annotations) {
  	JClassType classType = typeOracle.findType(ReflectionUtils.getQualifiedSourceName(annotation.annotationType()));
  	if (classType != null){
  		source.print(dest + ".addAnnotation(" + createAnnotationValues(typeOracle, annotation, logger) + ");");
			
  	}else{
  		logger.log(Type.ERROR, "Annotation (" + ReflectionUtils.getQualifiedSourceName(annotation.annotationType()) + ") not exists in compiled client source code, please ensure this class is exists and included in your module(.gwt.xml) file. GWTENT reflection process will ignore it and continue. ");
  	}
   }
}
 
开发者ID:liraz,项目名称:gwt-backbone,代码行数:17,代码来源:GeneratorHelper.java


示例5: loadClass

import com.google.gwt.core.ext.TreeLogger.Type; //导入依赖的package包/类
/**
 * @inheritDoc
 *
 * Gin class loading implementation, making sure that classes are loaded consistently and can be
 * GWT generated or super-source classes. See description {@link GinBridgeClassLoader above}.
 */
@Override
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
  Class<?> clazz = findLoadedClass(name);
  if (clazz == null) {
    if (inExceptedPackage(name)) {
      clazz = super.loadClass(name, false);
    } else {
      try {
        clazz = findClass(name);          
      } catch (ClassNotFoundException e) {
        clazz = super.loadClass(name, false);
        if (!clazz.isAnnotation()) { // Annotations are always safe to load
          logger.log(Type.WARN, String.format(
              "Class %s is used in Gin, but not available in GWT client code.", name));
        }
      }
    }
  }

  if (resolve) {
    resolveClass(clazz);
  }

  return clazz;
}
 
开发者ID:google-code-export,项目名称:google-gin,代码行数:32,代码来源:GinBridgeClassLoader.java


示例6: findSource

import com.google.gwt.core.ext.TreeLogger.Type; //导入依赖的package包/类
/**
 * Find the ginjector that we "really" get the binding for key from.  That is,
 * if it is inherited from a child/parent, return that injector.
 */
private GinjectorBindings findSource(GinjectorBindings ginjector, Key<?> key) {
  Set<GinjectorBindings> visited = new LinkedHashSet<GinjectorBindings>();

  GinjectorBindings lastGinjector = null;
  while (ginjector != null) {
    if (!visited.add(ginjector)) {
      logger.log(Type.ERROR, PrettyPrinter.format(
        "Cycle detected in bindings for %s", key));
      for (GinjectorBindings visitedBindings : visited) {
        PrettyPrinter.log(logger, Type.ERROR, "  %s", visitedBindings);
      }
      return ginjector; // at this point, just return *something*
    }
    
    lastGinjector = ginjector;
    ginjector = linkedGinjector(ginjector.getBinding(key));
  }
  return lastGinjector;
}
 
开发者ID:google-code-export,项目名称:google-gin,代码行数:24,代码来源:DoubleBindingChecker.java


示例7: getBrowserTabImage

import com.google.gwt.core.ext.TreeLogger.Type; //导入依赖的package包/类
private Image getBrowserTabImage(BrowserTab browserTab) {
  String imageId = DevModeImages.WEB_BROWSER;
  if (browserTab.isTerminated()) {
    imageId = DevModeImages.WEB_BROWSER_TERMINATED;
  } else {
    String attentionLevel = browserTab.getNeedsAttentionLevel();
    if (attentionLevel != null) {
      Type logLevel = LogEntry.toTreeLoggerType(attentionLevel);
      if (logLevel == Type.ERROR) {
        imageId = DevModeImages.WEB_BROWSER_ERROR;
      } else if (logLevel == Type.WARN) {
        imageId = DevModeImages.WEB_BROWSER_WARNING;
      }
    }
  }

  return Activator.getDefault().getImage(imageId);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:19,代码来源:ModelLabelProvider.java


示例8: getLaunchConfigurationImage

import com.google.gwt.core.ext.TreeLogger.Type; //导入依赖的package包/类
private Image getLaunchConfigurationImage(LaunchConfiguration launchConfiguration) {
  String launchConfigType = launchConfiguration.getLaunchTypeId();
  String imageId = DevModeImages.GDT_ICON;

  if (launchConfiguration.isTerminated()) {
    imageId = DevModeImages.GDT_ICON_TERMINATED;
  } else {
    String attentionLevel = launchConfiguration.getNeedsAttentionLevel();
    if (attentionLevel != null) {
      Type logLevel = LogEntry.toTreeLoggerType(attentionLevel);
      if (logLevel == Type.ERROR) {
        imageId = DevModeImages.GDT_ICON_ERROR;
      } else if (logLevel == Type.WARN) {
        imageId = DevModeImages.GDT_ICON_WARNING;
      }
    }
  }

  return Activator.getDefault().getImage(imageId);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:21,代码来源:ModelLabelProvider.java


示例9: generateIncrementally

import com.google.gwt.core.ext.TreeLogger.Type; //导入依赖的package包/类
@Override
public RebindResult generateIncrementally(TreeLogger logger,
                                          GeneratorContext context,
                                          String typeName)
    throws UnableToCompleteException {

  TypeOracle typeOracle = context.getTypeOracle();
  assert (typeOracle != null);

  JClassType toGenerate = typeOracle.findType(typeName)
                                    .isInterface();
  if (toGenerate == null) {
    logger.log(Type.ERROR,
               typeName + " is not an interface");
    throw new UnableToCompleteException();
  }

  TreeLogger propertyLogger = logger.branch(TreeLogger.DEBUG,
                                            "property generator",
                                            null);

  return create(propertyLogger,
                context,
                toGenerate);
}
 
开发者ID:gwt4e,项目名称:gwt4e,代码行数:26,代码来源:BindingPropertyGenerator.java


示例10: loadClass

import com.google.gwt.core.ext.TreeLogger.Type; //导入依赖的package包/类
/**
 * @inheritDoc
 *
 * Gin class loading implementation, making sure that classes are loaded consistently and can be
 * GWT generated or super-source classes. See description {@link GinBridgeClassLoader above}.
 */
@Override
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
  Class<?> clazz = findLoadedClass(name);
  if (clazz == null) {
    if (inExceptedPackage(name)) {
      clazz = super.loadClass(name, false);
    } else {
      try {
        clazz = findClass(name);
      } catch (ClassNotFoundException e) {
        clazz = super.loadClass(name, false);
        if (!clazz.isAnnotation()) { // Annotations are always safe to load
          logger.log(Type.WARN, String.format(
              "Class %s is used in Gin, but not available in GWT client code.", name));
        }
      }
    }
  }

  if (resolve) {
    resolveClass(clazz);
  }

  return clazz;
}
 
开发者ID:jyavu,项目名称:jytsu,代码行数:32,代码来源:GinBridgeClassLoader.java


示例11: testEntryPointCompiles

import com.google.gwt.core.ext.TreeLogger.Type; //导入依赖的package包/类
@Test
public void testEntryPointCompiles() {
  if ("true".equals(System.getProperty("xapi.build.quick"))) {
    return;
  }
  final GwtcService gwtc = X_Gwtc.getGeneratorForClass(CaseEntryPoint.class, GENERATED_MODULE_NAME);
  final GwtcProjectGenerator project = gwtc.getProject(GENERATED_MODULE_NAME);
  project.addJUnitClass(GwtcCaseJunit4.class);
  project.addPackage(GwtcCaseJunit4.class.getPackage(), true);
  final GwtManifest manifest = project.getManifest();
  manifest.setLogLevel(Type.WARN);
  manifest.setUseCurrentJvm(false);
  manifest.addSystemProp("gwt.usearchives=false");
  manifest.setLogFile(GwtcJobMonitor.STD_OUT_TO_STD_ERR);
  Assert.assertEquals(0, gwtc.compile(manifest));
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:17,代码来源:GwtcEntryPointTest.java


示例12: extractSingletonOverrides

import com.google.gwt.core.ext.TreeLogger.Type; //导入依赖的package包/类
protected void extractSingletonOverrides(TreeLogger logger, JClassType type, GeneratorContext context) {
  SingletonOverride singletonOverride = type.getAnnotation(SingletonOverride.class);
  if (singletonOverride == null) return;
  if (platforms.isAllowedType(type)) {
    JClassType override = gwtSingletons.get(singletonOverride.implFor());
    if (override == null) {
      gwtSingletons.put(singletonOverride.implFor(), type);
    } else {
      // TODO: have a config setting for "prefer platform or prefer priority";
      // currently, we prefer platform matches first, then sorted by priority.
      // The flag would make this check only look at priority, and ignore platform.
      JClassType best = platforms.prefer(type, override, SingletonOverride.class);
      logger.log(Type.WARN, best.getSimpleSourceName()+" chosen out of " +
      		type.getSimpleSourceName()+" and "+override.getSimpleSourceName());
      if (best == type) {
        gwtSingletons.put(singletonOverride.implFor(), type);
      }
    }
  }
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:21,代码来源:GwtInjectionMap.java


示例13: log

import com.google.gwt.core.ext.TreeLogger.Type; //导入依赖的package包/类
public static void log(TreeLogger treeLogger, Type type, String msg, Throwable caught,
    HelpInfo helpInfo) {
  switch(type) {
  case ALL:
  case DEBUG:
  case SPAM:
    X_Log.debug(msg, caught);
    break;
  case TRACE:
    X_Log.trace(msg, caught);
    break;
  case INFO:
    X_Log.info(msg, caught);
    break;
  case WARN:
    X_Log.warn(msg, caught);
    break;
  case ERROR:
    X_Log.error(msg, caught);
    break;
  }
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:23,代码来源:SuperTreeLogger.java


示例14: implementAction

import com.google.gwt.core.ext.TreeLogger.Type; //导入依赖的package包/类
private void implementAction(final TreeLogger logger,final ModelGenerator generator, final JMethod method, final ModelMagic models, final Annotation[] annos) {
    final boolean fluent = ModelGeneratorGwt.isFluent(method);
    final JPrimitiveType primitive = method.getReturnType().isPrimitive();
    if (primitive != JPrimitiveType.VOID) {
      if (!fluent) {
        //non-fluent, non-void return type is not an action
        //TODO change this!
//        implementGetter(logger, mb, method, models, annos, method.getReturnType().getSimpleSourceName());
        logger.log(Type.ERROR, "No getter for "+method.getJsniSignature()+"; " +
        		"If your type does not use javabean getField() naming conventions, " +
        		"then you MUST annotate a getter field with @GetterField");
      }
      return;
    }
    final MethodBuffer mb = generator.createMethod(method.getReturnType().getQualifiedSourceName(),
      method.getName(), ModelGeneratorGwt.typeToParameterString(method.getParameterTypes()));

    if (method.getName().equals("clear")) {
      //implement clear
    }

    if (fluent) {
      mb.println("return this;");
    }
  }
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:26,代码来源:ModelArtifact.java


示例15: existingTypesUnchanged

import com.google.gwt.core.ext.TreeLogger.Type; //导入依赖的package包/类
protected static <Ctx extends HtmlGeneratorResult> Ctx existingTypesUnchanged(final TreeLogger logger,
    final UnifyAstView ast, final Ctx result, final String verify) {
  if (isDev.get()) {
    // During development, never reuse existing types, as we're likely changing generators
    return null;
  }
  try {
    if (result.getSourceType() == null) {
      return null;
    }
    final Generated gen = result.getSourceType().getAnnotation(Generated.class);
    if (gen == null) {
      return null;
    }
    final String hash = gen.value()[gen.value().length-1];
    if (verify.equals(hash)) {
      return result;
    }
  } catch (final Exception e) {
    logger.log(Type.WARN, "Unknown error calculating change hashes", e);
  }
  return null;
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:24,代码来源:AbstractHtmlGenerator.java


示例16: injectMagic

import com.google.gwt.core.ext.TreeLogger.Type; //导入依赖的package包/类
@Override
public JExpression injectMagic(final TreeLogger logger, final JMethodCall methodCall, final JMethod currentMethod,
    final Context context, final UnifyAstView ast) throws UnableToCompleteException {
  if (methodCall.getArgs().size() != 1) {
    logger.log(Type.ERROR, "X_Reflect.magicClass accepts one and only one argument: a class literal.");
    throw new UnableToCompleteException();
  }
  if (!(methodCall.getArgs().get(0) instanceof JClassLiteral)) {
    logger.log(Type.ERROR, "X_Reflect.magicClass accepts one and only one argument: a class literal." +
        " You sent a " + methodCall.getArgs().get(0).getClass() + " : " +
        methodCall.getArgs().get(0).toSource());
    throw new UnableToCompleteException();
  }
  final JClassLiteral clazz = (JClassLiteral) methodCall.getArgs().get(0);
  return mappedClasses.get(clazz.getRefType().getName(), new ReflectionGeneratorContext(logger, clazz, methodCall,
      currentMethod, context, ast));
}
 
开发者ID:WeTheInternet,项目名称:xapi,代码行数:18,代码来源:MagicClassInjector.java


示例17: findType

import com.google.gwt.core.ext.TreeLogger.Type; //导入依赖的package包/类
private static JType findType( TreeLogger logger, PropertyAccessors fieldAccessors, JacksonTypeOracle typeOracle ) throws
        UnableToCompleteException {
    JType type;
    if ( fieldAccessors.getGetter().isPresent() ) {
        type = fieldAccessors.getGetter().get().getReturnType();
    } else if ( fieldAccessors.getSetter().isPresent() ) {
        type = fieldAccessors.getSetter().get().getParameters()[0].getType();
    } else if ( fieldAccessors.getField().isPresent() ) {
        type = fieldAccessors.getField().get().getType();
    } else if ( fieldAccessors.getParameter().isPresent() ) {
        type = fieldAccessors.getParameter().get().getType();
    } else {
        logger.log( Type.ERROR, "Cannot find the type of the property " + fieldAccessors.getPropertyName() );
        throw new UnableToCompleteException();
    }

    Optional<Annotation> jd = fieldAccessors.getAnnotation( "com.fasterxml.jackson.databind.annotation.JsonDeserialize" );
    if ( jd.isPresent() ) {
        return typeOracle.replaceType( logger, type, jd.get() );
    }

    return type;
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:24,代码来源:PropertyProcessor.java


示例18: parseFields

import com.google.gwt.core.ext.TreeLogger.Type; //导入依赖的package包/类
private static void parseFields( TreeLogger logger, JClassType type, Map<String, PropertyAccessorsBuilder> propertiesMap,
                                 boolean mixin ) {
    if ( type.getQualifiedSourceName().equals( "java.lang.Object" ) ) {
        return;
    }

    for ( JField field : type.getFields() ) {
        if ( field.isStatic() ) {
            continue;
        }

        String fieldName = field.getName();
        PropertyAccessorsBuilder property = propertiesMap.get( fieldName );
        if ( null == property ) {
            property = new PropertyAccessorsBuilder( fieldName );
            propertiesMap.put( fieldName, property );
        }
        if ( property.getField().isPresent() && !mixin ) {
            // we found an other field with the same name on a superclass. we ignore it
            logger.log( Type.INFO, "A field with the same name as '" + field
                    .getName() + "' has already been found on child class" );
        } else {
            property.addField( field, mixin );
        }
    }
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:27,代码来源:PropertyParser.java


示例19: getJsonSerializerFromProperty

import com.google.gwt.core.ext.TreeLogger.Type; //导入依赖的package包/类
private JSerializerType getJsonSerializerFromProperty( PropertyInfo propertyInfo ) throws UnableToCompleteException {
    if ( null != propertyInfo && propertyInfo.getGetterAccessor().isPresent() && !propertyInfo.isIgnored() ) {
        if ( propertyInfo.isRawValue() ) {
            return new JSerializerType.Builder().type( propertyInfo.getType() ).instance( CodeBlock.builder()
                    .add( "$T.<$T>getInstance()", RawValueJsonSerializer.class, typeName( propertyInfo.getType() ) ).build() )
                    .build();
        } else {
            try {
                return getJsonSerializerFromType( propertyInfo.getType() );
            } catch ( UnsupportedTypeException e ) {
                logger.log( Type.WARN, "Property '" + propertyInfo.getPropertyName() + "' is ignored." );
            }
        }
    }
    return null;
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:17,代码来源:BeanJsonSerializerCreator.java


示例20: buildCommonPropertyParameters

import com.google.gwt.core.ext.TreeLogger.Type; //导入依赖的package包/类
/**
 * Add the common property parameters to the code builder.
 *
 * @param paramBuilder the code builder
 * @param property the information about the property
 */
protected final void buildCommonPropertyParameters( CodeBlock.Builder paramBuilder, PropertyInfo property ) {
    if ( property.getFormat().isPresent() ) {
        JsonFormat format = property.getFormat().get();

        if ( !Strings.isNullOrEmpty( format.pattern() ) ) {
            paramBuilder.add( "\n.setPattern($S)", format.pattern() );
        }

        paramBuilder.add( "\n.setShape($T.$L)", Shape.class, format.shape().name() );

        if ( !Strings.isNullOrEmpty( format.locale() ) && !JsonFormat.DEFAULT_LOCALE.equals( format.locale() ) ) {
            logger.log( Type.WARN, "JsonFormat.locale is not supported by default" );
            paramBuilder.add( "\n.setLocale($S)", format.locale() );
        }
    }

    if ( property.getIgnoredProperties().isPresent() ) {
        for ( String ignoredProperty : property.getIgnoredProperties().get() ) {
            paramBuilder.add( "\n.addIgnoredProperty($S)", ignoredProperty );
        }
    }
}
 
开发者ID:nmorel,项目名称:gwt-jackson,代码行数:29,代码来源:AbstractBeanJsonCreator.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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