当前位置: 首页>>代码示例>>Java>>正文


Java DefaultGroovyMethods类代码示例

本文整理汇总了Java中org.codehaus.groovy.runtime.DefaultGroovyMethods的典型用法代码示例。如果您正苦于以下问题:Java DefaultGroovyMethods类的具体用法?Java DefaultGroovyMethods怎么用?Java DefaultGroovyMethods使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DefaultGroovyMethods类属于org.codehaus.groovy.runtime包,在下文中一共展示了DefaultGroovyMethods类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createBuilderAfterEvaluate

import org.codehaus.groovy.runtime.DefaultGroovyMethods; //导入依赖的package包/类
public void createBuilderAfterEvaluate() throws Exception {

        AndroidBuilder androidBuilder = appPluginHook.getAndroidBuilder();

        if (null == androidBuilder) {
            return;
        }

        AndroidBuilder atlasBuilder = new AtlasBuilder(project.equals(project.getRootProject()) ? project
                .getName() : project.getPath(),
                                                       creator,
                                                       new GradleProcessExecutor(project),
                                                       new GradleJavaProcessExecutor(project),
                                                       DefaultGroovyMethods.asType(ReflectUtils.getField(
                                                               androidBuilder,
                                                               "mErrorReporter"),
                                                                                   ErrorReporter.class),
                                                       LoggerWrapper.getLogger(AtlasBuilder.class),
                                                       DefaultGroovyMethods.asType(ReflectUtils.getField(
                                                               androidBuilder,
                                                               "mVerboseExec"), Boolean.class));

        ((AtlasBuilder) atlasBuilder).setDefaultBuilder(androidBuilder);
        ((AtlasBuilder) atlasBuilder).setAtlasExtension(atlasExtension);
        AtlasBuildContext.androidBuilderMap.put(project, (AtlasBuilder) (atlasBuilder));
    }
 
开发者ID:alibaba,项目名称:atlas,代码行数:27,代码来源:AtlasConfigurationHelper.java

示例2: configTasksAfterEvaluate

import org.codehaus.groovy.runtime.DefaultGroovyMethods; //导入依赖的package包/类
public void configTasksAfterEvaluate() {

        if (PluginTypeUtils.isAppProject(project)) {
            AppExtension appExtension = DefaultGroovyMethods.asType(DefaultGroovyMethods.getAt(
                    project.getExtensions(),
                    "android"), AppExtension.class);
            new AtlasAppTaskManager(AtlasBuildContext.androidBuilderMap.get(project),
                                    appExtension,
                                    project,
                                    atlasExtension).run();
        } else if (PluginTypeUtils.isLibraryProject(project)) {
            LibraryExtension libExtension = DefaultGroovyMethods.asType(DefaultGroovyMethods.getAt(
                    project.getExtensions(),
                    "android"), LibraryExtension.class);
            new AtlasLibTaskManager(AtlasBuildContext.androidBuilderMap.get(project),
                                    libExtension,
                                    project,
                                    atlasExtension).run();
        }
    }
 
开发者ID:alibaba,项目名称:atlas,代码行数:21,代码来源:AtlasConfigurationHelper.java

示例3: getSnapshot

import org.codehaus.groovy.runtime.DefaultGroovyMethods; //导入依赖的package包/类
@Override
default Publisher<SnapshotT> getSnapshot(long maxPosition, AggregateT aggregate) {
    return toPublisher(defer(() -> {
        //noinspection unchecked
        List<SnapshotT> snapshots = (List<SnapshotT>) (maxPosition == Long.MAX_VALUE ?
                invokeStaticMethod(
                        getSnapshotClass(),
                        SNAPSHOTS_BY_AGGREGATE,
                        new Object[]{aggregate.getId(), LATEST_BY_POSITION}) :
                invokeStaticMethod(
                        getSnapshotClass(),
                        SNAPSHOTS_BY_POSITION,
                        new Object[]{aggregate.getId(), maxPosition, LATEST_BY_POSITION}));

        return DefaultGroovyMethods.asBoolean(snapshots) ?
                just(detachSnapshot(snapshots.get(0))) :
                empty();
    }));
}
 
开发者ID:rahulsom,项目名称:grooves,代码行数:20,代码来源:BlockingSnapshotSource.java

示例4: testChangePassword

import org.codehaus.groovy.runtime.DefaultGroovyMethods; //导入依赖的package包/类
@Test
public void testChangePassword() throws Exception {
  ArgumentCaptor<String> rawPasswordCaptor =
      (ArgumentCaptor<String>) ArgumentCaptor.forClass(String.class);

  when(passwordSecurity.ecrypt(rawPasswordCaptor.capture()))
      .thenReturn(new Password("test", "test"));

  User changedUser = userService.changePassword(user1.getId(), "somepassword");
  Assert.assertNotNull(changedUser);
  Assert.assertNotNull(changedUser.getPassword());

  DefaultGroovyMethods
      .invokeMethod(Mockito.verify(passwordSecurity), "ecrypt", new Object[]{"somepassword"});

  assertEmittedUserEvent(PASSWORD_CHANGED);
}
 
开发者ID:springuni,项目名称:springuni-particles,代码行数:18,代码来源:UserServiceTest.java

示例5: mixinGlobally

import org.codehaus.groovy.runtime.DefaultGroovyMethods; //导入依赖的package包/类
/**
 * Mix all the static methods of the given class into their
 * respective types.
 * @param classToMix a category class.
 */
protected void mixinGlobally(Class<?> classToMix) {
  // find the set of types into which it needs to be mixed.
  // this means the types of the first argument of each
  // static method in the class.
  Set<Class<?>> typesToMixInto = new HashSet<Class<?>>();
  for(Method method : classToMix.getMethods()) {
    if(Modifier.isStatic(method.getModifiers())
            && method.getDeclaringClass() == classToMix
            && method.getParameterTypes().length > 0) {
      typesToMixInto.add(method.getParameterTypes()[0]);
    }
  }
  for(Class<?> clazz : typesToMixInto) {
    DefaultGroovyMethods.mixin(clazz, classToMix);
  }
}
 
开发者ID:KHP-Informatics,项目名称:ADRApp,代码行数:22,代码来源:GroovySupport.java

示例6: inferExpectedSignatures

import org.codehaus.groovy.runtime.DefaultGroovyMethods; //导入依赖的package包/类
@NotNull
@Override
public List<PsiType[]> inferExpectedSignatures(@NotNull final PsiMethod method,
                                               @NotNull PsiSubstitutor substitutor,
                                               @NotNull String[] options) {
  return Collections.singletonList(ContainerUtil.map(options, new Function<String, PsiType>() {
    @Override
    public PsiType fun(String value) {
      try {
        PsiType type = JavaPsiFacade.getElementFactory(method.getProject()).createTypeFromText(value, method);
        return DefaultGroovyMethods.asBoolean(type) ? type : PsiType.NULL;
      }
      catch (IncorrectOperationException e) {
        return PsiType.NULL;
      }
    }
  }, new PsiType[options.length]));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:SimpleTypeHintProcessor.java

示例7: getElementPredicate

import org.codehaus.groovy.runtime.DefaultGroovyMethods; //导入依赖的package包/类
@NotNull
@Override
protected PsiElementPredicate getElementPredicate() {
  return new PsiElementPredicate() {
    @Override
    public boolean satisfiedBy(PsiElement element) {
      if (!element.getNode().getElementType().equals(GroovyTokenTypes.kIF)) return false;
      if (!(element.getParent() instanceof GrIfStatement)) return false;

      final GrIfStatement ifStatement = DefaultGroovyMethods.asType(element.getParent(), GrIfStatement.class);

      final GrIfStatement elseIf = getElseIf(ifStatement);
      return elseIf != null && checkIf(ifStatement) && checkIf(elseIf);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:FlipIfIntention.java

示例8: getElementPredicate

import org.codehaus.groovy.runtime.DefaultGroovyMethods; //导入依赖的package包/类
@NotNull
@Override
protected PsiElementPredicate getElementPredicate() {
  return new PsiElementPredicate() {
    @Override
    public boolean satisfiedBy(PsiElement element) {
      PsiElement parent = element.getParent();
      if (parent instanceof GrArgumentLabel &&
          ((GrArgumentLabel)parent).getNameElement().equals(element) &&
          parent.getParent() != null &&
          parent.getParent().getParent() instanceof GrListOrMap) {
        GrListOrMap map = DefaultGroovyMethods.asType(parent.getParent().getParent(), GrListOrMap.class);
        if (!ErrorUtil.containsError(map) && map.getInitializers().length == 0 && isLiteralKeys(map.getNamedArguments())) {
          return true;
        }
      }


      return false;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GrSortMapKeysIntention.java

示例9: getParentInterfaces

import org.codehaus.groovy.runtime.DefaultGroovyMethods; //导入依赖的package包/类
public Set<GroovyClassDoc> getParentInterfaces() {
    Set<GroovyClassDoc> result = new LinkedHashSet<GroovyClassDoc>();
    result.add(this);
    Set<GroovyClassDoc> next = new LinkedHashSet<GroovyClassDoc>();
    next.addAll(Arrays.asList(this.interfaces()));
    while (!next.isEmpty()) {
        Set<GroovyClassDoc> temp = next;
        next = new LinkedHashSet<GroovyClassDoc>();
        for (GroovyClassDoc t : temp) {
            if (t instanceof SimpleGroovyClassDoc) {
                next.addAll(((SimpleGroovyClassDoc)t).getParentInterfaces());
            } else if (t instanceof ExternalGroovyClassDoc) {
                ExternalGroovyClassDoc d = (ExternalGroovyClassDoc) t;
                next.addAll(getJavaInterfaces(d));
            }
        }
        next = DefaultGroovyMethods.minus(next, result);
        result.addAll(next);
    }
    return result;
}
 
开发者ID:apache,项目名称:groovy,代码行数:22,代码来源:SimpleGroovyClassDoc.java

示例10: serialize

import org.codehaus.groovy.runtime.DefaultGroovyMethods; //导入依赖的package包/类
public static void serialize(final String name, final Object ast) {
    if (name == null || name.length() == 0) return;

    XStream xstream = new XStream(new StaxDriver());
    FileWriter astFileWriter = null;
    try {
        File astFile = astFile(name);
        if (astFile == null) {
            System.out.println("File-name for writing " + name + " AST could not be determined!");
            return;
        }
        astFileWriter = new FileWriter(astFile, false);
        xstream.toXML(ast, astFileWriter);
        System.out.println("Written AST to " + name + ".xml");

    } catch (Exception e) {
        System.out.println("Couldn't write to " + name + ".xml");
        e.printStackTrace();
    } finally {
        DefaultGroovyMethods.closeQuietly(astFileWriter);
    }
}
 
开发者ID:apache,项目名称:groovy,代码行数:23,代码来源:XStreamUtils.java

示例11: toString

import org.codehaus.groovy.runtime.DefaultGroovyMethods; //导入依赖的package包/类
public String toString() {
    List buffer = new ArrayList();

    if (this.years != 0) buffer.add(this.years + " years");
    if (this.months != 0) buffer.add(this.months + " months");
    if (this.days != 0) buffer.add(this.days + " days");
    if (this.hours != 0) buffer.add(this.hours + " hours");
    if (this.minutes != 0) buffer.add(this.minutes + " minutes");

    if (this.seconds != 0 || this.millis != 0) {
        int norm_millis = this.millis % 1000;
        int norm_seconds = this.seconds + DefaultGroovyMethods.intdiv(this.millis - norm_millis, 1000).intValue();
        CharSequence millisToPad = "" + Math.abs(norm_millis);
        buffer.add((norm_seconds == 0 ? (norm_millis < 0 ? "-0" : "0") : norm_seconds) + "." + StringGroovyMethods.padLeft(millisToPad, 3, "0") + " seconds");
    }

    if (!buffer.isEmpty()) {
        return DefaultGroovyMethods.join(buffer.iterator(), ", ");
    } else {
        return "0";
    }
}
 
开发者ID:apache,项目名称:groovy,代码行数:23,代码来源:BaseDuration.java

示例12: connectMultimethods

import org.codehaus.groovy.runtime.DefaultGroovyMethods; //导入依赖的package包/类
private void connectMultimethods(List<CachedClass> superClasses, CachedClass firstGroovyClass) {
    superClasses = DefaultGroovyMethods.reverse(superClasses);
    MetaMethodIndex.Header last = null;
    for (final CachedClass c : superClasses) {
        MetaMethodIndex.Header methodIndex = metaMethodIndex.getHeader(c.getTheClass());
        // We don't copy DGM methods to superclasses' indexes
        // The reason we can do that is particular set of DGM methods in use,
        // if at some point we will define DGM method for some Groovy class or
        // for a class derived from such, we will need to revise this condition.
        // It saves us a lot of space and some noticeable time
        if (last != null) metaMethodIndex.copyNonPrivateNonNewMetaMethods(last, methodIndex);
        last = methodIndex;

        if (c == firstGroovyClass)
            break;
    }
}
 
开发者ID:apache,项目名称:groovy,代码行数:18,代码来源:MetaClassImpl.java

示例13: breadthFirstRest

import org.codehaus.groovy.runtime.DefaultGroovyMethods; //导入依赖的package包/类
private List breadthFirstRest(boolean preorder) {
    List answer = new NodeList();
    Stack stack = new Stack();
    List nextLevelChildren = preorder ? getDirectChildren() : DefaultGroovyMethods.reverse(getDirectChildren());
    while (!nextLevelChildren.isEmpty()) {
        List working = new NodeList(nextLevelChildren);
        nextLevelChildren = new NodeList();
        for (Object child : working) {
            if (preorder) {
                answer.add(child);
            } else {
                stack.push(child);
            }
            if (child instanceof Node) {
                Node childNode = (Node) child;
                List children = childNode.getDirectChildren();
                if (children.size() > 1 || (children.size() == 1 && !(children.get(0) instanceof String))) nextLevelChildren.addAll(preorder ? children : DefaultGroovyMethods.reverse(children));
            }
        }
    }
    while (!stack.isEmpty()) {
        answer.add(stack.pop());
    }
    return answer;
}
 
开发者ID:apache,项目名称:groovy,代码行数:26,代码来源:Node.java

示例14: testAfterPropertiesSet

import org.codehaus.groovy.runtime.DefaultGroovyMethods; //导入依赖的package包/类
@Test
public void testAfterPropertiesSet() {
    try {
        generator.setLinkService(null);
        generator.afterPropertiesSet();
        Assert.fail("expected illegal arg exception");
    } catch (Exception e) {
        // NOOP
    }

    generator.setLinkService(DefaultGroovyMethods.asType(new Closure<Void>(this, this) {
        public void doCall(Object it) {
        }

        public void doCall() {
            doCall(null);
        }

    }, ILinkService.class));
    generator.afterPropertiesSet();
}
 
开发者ID:KRMAssociatesInc,项目名称:eHMP,代码行数:22,代码来源:ResultTrendLinkGeneratorTests.java

示例15: findActions

import org.codehaus.groovy.runtime.DefaultGroovyMethods; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected Set<Class> findActions()  {
	Set<Class> set = super.findActions();
	for( int index = 0; groovyActionPackages != null && index < groovyActionPackages.length; index++ ){
		try{
			String groovyPackage = srcPath+groovyActionPackages[index];
			URL url = new URL(groovyPackage);
			File folderList=new File(url.toURI()); 
			File list[] = folderList.listFiles(); 
	        for(int i=0;i <list.length;i++) {
	        	File file = list[i];
	        	if(file.toString().endsWith(Constants.GROOVY_EXTENSION) && !file.isDirectory()){
	        		String groovyPath = url.toString()+"/"+file.getName();
	        		URL gUrl = new URL(groovyPath);
	        		Class scriptClass = groovyClassLoader.parseClass(DefaultGroovyMethods.getText(gUrl, "UTF-8") );
	    			set.add(scriptClass);
	        	}
	        }
		}catch(Exception e){
			e.printStackTrace();
		}
	}
	return set;
}
 
开发者ID:gxbcj,项目名称:GroovyAction,代码行数:26,代码来源:GxbActionConfigBuilder.java


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