_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q2100 | CmsXmlConfigUpdater.transform | train | public void transform(String name, String transform) throws Exception {
File configFile = new File(m_configDir, name);
File transformFile = new File(m_xsltDir, transform);
try (InputStream stream = new FileInputStream(transformFile)) {
StreamSource source = new StreamSource(stream);... | java | {
"resource": ""
} |
q2101 | CmsXmlConfigUpdater.transformConfig | train | public void transformConfig() throws Exception {
List<TransformEntry> entries = readTransformEntries(new File(m_xsltDir, "transforms.xml"));
for (TransformEntry entry : entries) {
transform(entry.getConfigFile(), entry.getXslt());
}
m_isDone = true;
} | java | {
"resource": ""
} |
q2102 | CmsXmlConfigUpdater.validationErrors | train | public String validationErrors() {
List<String> errors = new ArrayList<>();
for (File config : getConfigFiles()) {
String filename = config.getName();
try (FileInputStream stream = new FileInputStream(config)) {
CmsXmlUtils.unmarshalHelper(CmsFileUtil.readFully(s... | java | {
"resource": ""
} |
q2103 | CmsXmlConfigUpdater.getConfigFiles | train | private List<File> getConfigFiles() {
String[] filenames = {
"opencms-modules.xml",
"opencms-system.xml",
"opencms-vfs.xml",
"opencms-importexport.xml",
"opencms-sites.xml",
"opencms-variables.xml",
"opencms-scheduler.xml",
... | java | {
"resource": ""
} |
q2104 | CmsXmlConfigUpdater.readTransformEntries | train | private List<TransformEntry> readTransformEntries(File file) throws Exception {
List<TransformEntry> result = new ArrayList<>();
try (FileInputStream fis = new FileInputStream(file)) {
byte[] data = CmsFileUtil.readFully(fis, false);
Document doc = CmsXmlUtils.unmarshalHelper(da... | java | {
"resource": ""
} |
q2105 | CmsXmlConfigUpdater.transform | train | private void transform(File file, Source transformSource)
throws TransformerConfigurationException, IOException, SAXException, TransformerException,
ParserConfigurationException {
Transformer transformer = m_transformerFactory.newTransformer(transformSource);
transformer.setOutputProperty(Outpu... | java | {
"resource": ""
} |
q2106 | CmsJspNavElement.getSubNavigation | train | public List<CmsJspNavElement> getSubNavigation() {
if (m_subNavigation == null) {
if (m_resource.isFile()) {
m_subNavigation = Collections.emptyList();
} else if (m_navContext == null) {
try {
throw new Exception("Can not get subnaviga... | java | {
"resource": ""
} |
q2107 | CmsJspNavElement.getLocaleProperties | train | private Map<String, String> getLocaleProperties() {
if (m_localeProperties == null) {
m_localeProperties = CmsCollectionsGenericWrapper.createLazyMap(
new CmsProperty.CmsPropertyLocaleTransformer(m_properties, m_locale));
}
return m_localeProperties;
} | java | {
"resource": ""
} |
q2108 | CmsPatternPanelDailyController.setEveryWorkingDay | train | public void setEveryWorkingDay(final boolean isEveryWorkingDay) {
if (m_model.isEveryWorkingDay() != isEveryWorkingDay) {
removeExceptionsOnChange(new Command() {
public void execute() {
m_model.setEveryWorkingDay(Boolean.valueOf(isEveryWorkingDay));
... | java | {
"resource": ""
} |
q2109 | CmsUploadBean.removeListener | train | private void removeListener(CmsUUID listenerId) {
getRequest().getSession().removeAttribute(SESSION_ATTRIBUTE_LISTENER_ID);
m_listeners.remove(listenerId);
} | java | {
"resource": ""
} |
q2110 | CmsFormatterBeanParser.parseAttributes | train | private Map<String, String> parseAttributes(I_CmsXmlContentLocation formatterLoc) {
Map<String, String> result = new LinkedHashMap<>();
for (I_CmsXmlContentValueLocation mappingLoc : formatterLoc.getSubValues(N_ATTRIBUTE)) {
String key = CmsConfigurationReader.getString(m_cms, mappingLoc.ge... | java | {
"resource": ""
} |
q2111 | CmsADEManager.getConfiguredWorkplaceBundles | train | public Set<String> getConfiguredWorkplaceBundles() {
CmsADEConfigData configData = internalLookupConfiguration(null, null);
return configData.getConfiguredWorkplaceBundles();
} | java | {
"resource": ""
} |
q2112 | CmsLinkManager.removeOpenCmsContext | train | public static String removeOpenCmsContext(final String path) {
String context = OpenCms.getSystemInfo().getOpenCmsContext();
if (path.startsWith(context + "/")) {
return path.substring(context.length());
}
String renderPrefix = OpenCms.getStaticExportManager().getVfsPrefix()... | java | {
"resource": ""
} |
q2113 | CmsLinkManager.getPermalink | train | public String getPermalink(CmsObject cms, String resourceName, CmsUUID detailContentId) {
String permalink = "";
try {
permalink = substituteLink(cms, CmsPermalinkResourceHandler.PERMALINK_HANDLER);
String id = cms.readResource(resourceName, CmsResourceFilter.ALL).getStructureId... | java | {
"resource": ""
} |
q2114 | CmsLinkManager.getPermalinkForCurrentPage | train | public String getPermalinkForCurrentPage(CmsObject cms) {
return getPermalink(cms, cms.getRequestContext().getUri(), cms.getRequestContext().getDetailContentId());
} | java | {
"resource": ""
} |
q2115 | CmsLinkManager.getWorkplaceLink | train | public String getWorkplaceLink(CmsObject cms, String resourceName, boolean forceSecure) {
String result = substituteLinkForUnknownTarget(cms, resourceName, forceSecure);
return appendServerPrefix(cms, result, resourceName, true);
} | java | {
"resource": ""
} |
q2116 | CmsSqlConsoleResultsForm.buildTable | train | private Table buildTable(CmsSqlConsoleResults results) {
IndexedContainer container = new IndexedContainer();
int numCols = results.getColumns().size();
for (int c = 0; c < numCols; c++) {
container.addContainerProperty(Integer.valueOf(c), results.getColumnType(c), null);
}
... | java | {
"resource": ""
} |
q2117 | CmsPropertiesTab.updateImageInfo | train | private void updateImageInfo() {
String crop = getCrop();
String point = getPoint();
m_imageInfoDisplay.fillContent(m_info, crop, point);
} | java | {
"resource": ""
} |
q2118 | CmsShell.getTopShell | train | public static CmsShell getTopShell() {
ArrayList<CmsShell> shells = SHELL_STACK.get();
if (shells.isEmpty()) {
return null;
}
return shells.get(shells.size() - 1);
} | java | {
"resource": ""
} |
q2119 | CmsShell.popShell | train | public static void popShell() {
ArrayList<CmsShell> shells = SHELL_STACK.get();
if (shells.size() > 0) {
shells.remove(shells.size() - 1);
}
} | java | {
"resource": ""
} |
q2120 | CmsSearchConfigurationSorting.create | train | public static CmsSearchConfigurationSorting create(
final String sortParam,
final List<I_CmsSearchConfigurationSortOption> options,
final I_CmsSearchConfigurationSortOption defaultOption) {
return (null != sortParam) || ((null != options) && !options.isEmpty()) || (null != defaultOption... | java | {
"resource": ""
} |
q2121 | CmsResourceTypeStatResultList.init | train | public static CmsResourceTypeStatResultList init(CmsResourceTypeStatResultList resList) {
if (resList == null) {
return new CmsResourceTypeStatResultList();
}
resList.deleteOld();
return resList;
} | java | {
"resource": ""
} |
q2122 | CmsExport.exportWithMinimalMetaData | train | protected boolean exportWithMinimalMetaData(String path) {
String checkPath = path.startsWith("/") ? path + "/" : "/" + path + "/";
for (String p : m_parameters.getResourcesToExportWithMetaData()) {
if (checkPath.startsWith(p)) {
return false;
}
}
... | java | {
"resource": ""
} |
q2123 | DOMImplWebkit.setDraggable | train | @Override
public void setDraggable(Element elem, String draggable) {
super.setDraggable(elem, draggable);
if ("true".equals(draggable)) {
elem.getStyle().setProperty("webkitUserDrag", "element");
} else {
elem.getStyle().clearProperty("webkitUserDrag");
}
} | java | {
"resource": ""
} |
q2124 | CmsNewResourceTypeDialog.createParentXmlElements | train | protected void createParentXmlElements(CmsXmlContent xmlContent, String xmlPath, Locale l) {
if (CmsXmlUtils.isDeepXpath(xmlPath)) {
String parentPath = CmsXmlUtils.removeLastXpathElement(xmlPath);
if (null == xmlContent.getValue(parentPath, l)) {
createParentXmlElements... | java | {
"resource": ""
} |
q2125 | Scheme.join | train | public byte[] join(Map<Integer, byte[]> parts) {
checkArgument(parts.size() > 0, "No parts provided");
final int[] lengths = parts.values().stream().mapToInt(v -> v.length).distinct().toArray();
checkArgument(lengths.length == 1, "Varying lengths of part values");
final byte[] secret = new byte[lengths[... | java | {
"resource": ""
} |
q2126 | Processor.sink | train | public static Processor<DataSinkTask> sink(DataSink dataSink, int parallelism, String description, UserConfig taskConf, ActorSystem system) {
io.gearpump.streaming.Processor<DataSinkTask> p = DataSinkProcessor.apply(dataSink, parallelism, description, taskConf, system);
return new Processor(p);
} | java | {
"resource": ""
} |
q2127 | Processor.source | train | public static Processor<DataSourceTask> source(DataSource source, int parallelism, String description, UserConfig taskConf, ActorSystem system) {
io.gearpump.streaming.Processor<DataSourceTask<Object, Object>> p =
DataSourceProcessor.apply(source, parallelism, description, taskConf, system);
return new ... | java | {
"resource": ""
} |
q2128 | BeetlAntlrErrorStrategy.recoverInline | train | @Override
public Token recoverInline(Parser recognizer) throws RecognitionException
{
// SINGLE TOKEN DELETION
Token matchedSymbol = singleTokenDeletion(recognizer);
if (matchedSymbol != null)
{
// we have deleted the extra token.
// now, move past ttype token as if all were ok
recognizer.co... | java | {
"resource": ""
} |
q2129 | AntlrProgramBuilder.parseDirectiveStatement | train | protected DirectiveStatement parseDirectiveStatement(DirectiveStContext node)
{
DirectiveStContext stContext = (DirectiveStContext) node;
DirectiveExpContext direExp = stContext.directiveExp();
Token token = direExp.Identifier().getSymbol();
String directive = token.getText().toLowerCase().intern();
Te... | java | {
"resource": ""
} |
q2130 | NamingConventions.determineNamingConvention | train | public static NamingConvention determineNamingConvention(
TypeElement type,
Iterable<ExecutableElement> methods,
Messager messager,
Types types) {
ExecutableElement beanMethod = null;
ExecutableElement prefixlessMethod = null;
for (ExecutableElement method : methods) {
switch (... | java | {
"resource": ""
} |
q2131 | SourceBuilder.add | train | public SourceBuilder add(String fmt, Object... args) {
TemplateApplier.withParams(args).onText(source::append).onParam(this::add).parse(fmt);
return this;
} | java | {
"resource": ""
} |
q2132 | SourceBuilder.addLine | train | public SourceBuilder addLine(String fmt, Object... args) {
add(fmt, args);
source.append(LINE_SEPARATOR);
return this;
} | java | {
"resource": ""
} |
q2133 | Analyser.findUnderriddenMethods | train | private Map<StandardMethod, UnderrideLevel> findUnderriddenMethods(
Iterable<ExecutableElement> methods) {
Map<StandardMethod, ExecutableElement> standardMethods = new LinkedHashMap<>();
for (ExecutableElement method : methods) {
Optional<StandardMethod> standardMethod = maybeStandardMethod(method);... | java | {
"resource": ""
} |
q2134 | Analyser.hasToBuilderMethod | train | private boolean hasToBuilderMethod(
DeclaredType builder,
boolean isExtensible,
Iterable<ExecutableElement> methods) {
for (ExecutableElement method : methods) {
if (isToBuilderMethod(builder, method)) {
if (!isExtensible) {
messager.printMessage(ERROR,
"No ac... | java | {
"resource": ""
} |
q2135 | Analyser.generatedBuilderSimpleName | train | private String generatedBuilderSimpleName(TypeElement type) {
String packageName = elements.getPackageOf(type).getQualifiedName().toString();
String originalName = type.getQualifiedName().toString();
checkState(originalName.startsWith(packageName + "."));
String nameWithoutPackage = originalName.substri... | java | {
"resource": ""
} |
q2136 | ToStringGenerator.addToString | train | public static void addToString(
SourceBuilder code,
Datatype datatype,
Map<Property, PropertyCodeGenerator> generatorsByProperty,
boolean forPartial) {
String typename = (forPartial ? "partial " : "") + datatype.getType().getSimpleName();
Predicate<PropertyCodeGenerator> isOptional = gen... | java | {
"resource": ""
} |
q2137 | ToStringGenerator.bodyWithConcatenation | train | private static void bodyWithConcatenation(
SourceBuilder code,
Map<Property, PropertyCodeGenerator> generatorsByProperty,
String typename) {
code.add(" return \"%s{", typename);
String prefix = "";
for (Property property : generatorsByProperty.keySet()) {
PropertyCodeGenerator gener... | java | {
"resource": ""
} |
q2138 | ToStringGenerator.bodyWithBuilder | train | private static void bodyWithBuilder(
SourceBuilder code,
Datatype datatype,
Map<Property, PropertyCodeGenerator> generatorsByProperty,
String typename,
Predicate<PropertyCodeGenerator> isOptional) {
Variable result = new Variable("result");
code.add(" %1$s %2$s = new %1$s(\"%3$s{... | java | {
"resource": ""
} |
q2139 | ToStringGenerator.bodyWithBuilderAndSeparator | train | private static void bodyWithBuilderAndSeparator(
SourceBuilder code,
Datatype datatype,
Map<Property, PropertyCodeGenerator> generatorsByProperty,
String typename) {
Variable result = new Variable("result");
Variable separator = new Variable("separator");
code.addLine(" %1$s %2$s =... | java | {
"resource": ""
} |
q2140 | LazyName.addLazyDefinitions | train | public static void addLazyDefinitions(SourceBuilder code) {
Set<Declaration> defined = new HashSet<>();
// Definitions may lazily declare new names; ensure we add them all
List<Declaration> declarations =
code.scope().keysOfType(Declaration.class).stream().sorted().collect(toList());
while (!de... | java | {
"resource": ""
} |
q2141 | PropertyCodeGenerator.addPartialFieldAssignment | train | public void addPartialFieldAssignment(
SourceBuilder code, Excerpt finalField, String builder) {
addFinalFieldAssignment(code, finalField, builder);
} | java | {
"resource": ""
} |
q2142 | MergeAction.addActionsTo | train | public static void addActionsTo(
SourceBuilder code,
Set<MergeAction> mergeActions,
boolean forBuilder) {
SetMultimap<String, String> nounsByVerb = TreeMultimap.create();
mergeActions.forEach(mergeAction -> {
if (forBuilder || !mergeAction.builderOnly) {
nounsByVerb.put(mergeActi... | java | {
"resource": ""
} |
q2143 | Declarations.upcastToGeneratedBuilder | train | public static Variable upcastToGeneratedBuilder(
SourceBuilder code, Datatype datatype, String builder) {
return code.scope().computeIfAbsent(Declaration.UPCAST, () -> {
Variable base = new Variable("base");
code.addLine(UPCAST_COMMENT)
.addLine("%s %s = %s;", datatype.getGeneratedBuilde... | java | {
"resource": ""
} |
q2144 | Declarations.freshBuilder | train | public static Optional<Variable> freshBuilder(SourceBuilder code, Datatype datatype) {
if (!datatype.getBuilderFactory().isPresent()) {
return Optional.empty();
}
return Optional.of(code.scope().computeIfAbsent(Declaration.FRESH_BUILDER, () -> {
Variable defaults = new Variable("defaults");
... | java | {
"resource": ""
} |
q2145 | Type.javadocMethodLink | train | public JavadocLink javadocMethodLink(String memberName, Type... types) {
return new JavadocLink("%s#%s(%s)",
getQualifiedName(),
memberName,
(Excerpt) code -> {
String separator = "";
for (Type type : types) {
code.add("%s%s", separator, type.getQualifiedName(... | java | {
"resource": ""
} |
q2146 | Type.typeParameters | train | public Excerpt typeParameters() {
if (getTypeParameters().isEmpty()) {
return Excerpts.EMPTY;
} else {
return Excerpts.add("<%s>", Excerpts.join(", ", getTypeParameters()));
}
} | java | {
"resource": ""
} |
q2147 | AbstractRule.createViolation | train | protected Violation createViolation(Integer lineNumber, String sourceLine, String message) {
Violation violation = new Violation();
violation.setRule(this);
violation.setSourceLine(sourceLine);
violation.setLineNumber(lineNumber);
violation.setMessage(message);
return vio... | java | {
"resource": ""
} |
q2148 | AbstractRule.createViolation | train | protected Violation createViolation(SourceCode sourceCode, ASTNode node, String message) {
String sourceLine = sourceCode.line(node.getLineNumber()-1);
return createViolation(node.getLineNumber(), sourceLine, message);
} | java | {
"resource": ""
} |
q2149 | AbstractRule.createViolationForImport | train | protected Violation createViolationForImport(SourceCode sourceCode, ImportNode importNode, String message) {
Map importInfo = ImportUtil.sourceLineAndNumberForImport(sourceCode, importNode);
Violation violation = new Violation();
violation.setRule(this);
violation.setSourceLine((String) ... | java | {
"resource": ""
} |
q2150 | AbstractRule.createViolationForImport | train | protected Violation createViolationForImport(SourceCode sourceCode, String className, String alias, String violationMessage) {
Map importInfo = ImportUtil.sourceLineAndNumberForImport(sourceCode, className, alias);
Violation violation = new Violation();
violation.setRule(this);
violation... | java | {
"resource": ""
} |
q2151 | AbstractAstVisitorRule.shouldApplyThisRuleTo | train | protected boolean shouldApplyThisRuleTo(ClassNode classNode) {
// TODO Consider caching applyTo, doNotApplyTo and associated WildcardPatterns
boolean shouldApply = true;
String applyTo = getApplyToClassNames();
String doNotApplyTo = getDoNotApplyToClassNames();
if (apply... | java | {
"resource": ""
} |
q2152 | AntFileSetSourceAnalyzer.analyze | train | public Results analyze(RuleSet ruleSet) {
long startTime = System.currentTimeMillis();
DirectoryResults reportResults = new DirectoryResults();
int numThreads = Runtime.getRuntime().availableProcessors() - 1;
numThreads = numThreads > 0 ? numThreads : 1;
ExecutorService ... | java | {
"resource": ""
} |
q2153 | AstUtil.isPredefinedConstant | train | private static boolean isPredefinedConstant(Expression expression) {
if (expression instanceof PropertyExpression) {
Expression object = ((PropertyExpression) expression).getObjectExpression();
Expression property = ((PropertyExpression) expression).getProperty();
if (o... | java | {
"resource": ""
} |
q2154 | AstUtil.isMapLiteralWithOnlyConstantValues | train | public static boolean isMapLiteralWithOnlyConstantValues(Expression expression) {
if (expression instanceof MapExpression) {
List<MapEntryExpression> entries = ((MapExpression) expression).getMapEntryExpressions();
for (MapEntryExpression entry : entries) {
if (!isCon... | java | {
"resource": ""
} |
q2155 | AstUtil.isListLiteralWithOnlyConstantValues | train | public static boolean isListLiteralWithOnlyConstantValues(Expression expression) {
if (expression instanceof ListExpression) {
List<Expression> expressions = ((ListExpression) expression).getExpressions();
for (Expression e : expressions) {
if (!isConstantOrConstantLi... | java | {
"resource": ""
} |
q2156 | AstUtil.isConstant | train | public static boolean isConstant(Expression expression, Object expected) {
return expression instanceof ConstantExpression && expected.equals(((ConstantExpression) expression).getValue());
} | java | {
"resource": ""
} |
q2157 | AstUtil.getMethodArguments | train | public static List<? extends Expression> getMethodArguments(ASTNode methodCall) {
if (methodCall instanceof ConstructorCallExpression) {
return extractExpressions(((ConstructorCallExpression) methodCall).getArguments());
} else if (methodCall instanceof MethodCallExpression) {
... | java | {
"resource": ""
} |
q2158 | AstUtil.isMethodNamed | train | public static boolean isMethodNamed(MethodCallExpression methodCall, String methodNamePattern, Integer numArguments) {
Expression method = methodCall.getMethod();
// !important: performance enhancement
boolean IS_NAME_MATCH = false;
if (method instanceof ConstantExpression) {
... | java | {
"resource": ""
} |
q2159 | AstUtil.isConstructorCall | train | public static boolean isConstructorCall(Expression expression, List<String> classNames) {
return expression instanceof ConstructorCallExpression && classNames.contains(expression.getType().getName());
} | java | {
"resource": ""
} |
q2160 | AstUtil.isConstructorCall | train | public static boolean isConstructorCall(Expression expression, String classNamePattern) {
return expression instanceof ConstructorCallExpression && expression.getType().getName().matches(classNamePattern);
} | java | {
"resource": ""
} |
q2161 | AstUtil.getAnnotation | train | public static AnnotationNode getAnnotation(AnnotatedNode node, String name) {
List<AnnotationNode> annotations = node.getAnnotations();
for (AnnotationNode annot : annotations) {
if (annot.getClassNode().getName().equals(name)) {
return annot;
}
}
... | java | {
"resource": ""
} |
q2162 | AstUtil.hasAnnotation | train | public static boolean hasAnnotation(AnnotatedNode node, String name) {
return AstUtil.getAnnotation(node, name) != null;
} | java | {
"resource": ""
} |
q2163 | AstUtil.hasAnyAnnotation | train | public static boolean hasAnyAnnotation(AnnotatedNode node, String... names) {
for (String name : names) {
if (hasAnnotation(node, name)) {
return true;
}
}
return false;
} | java | {
"resource": ""
} |
q2164 | AstUtil.getVariableExpressions | train | public static List<Expression> getVariableExpressions(DeclarationExpression declarationExpression) {
Expression leftExpression = declarationExpression.getLeftExpression();
// !important: performance enhancement
if (leftExpression instanceof ArrayExpression) {
List<Expression> e... | java | {
"resource": ""
} |
q2165 | AstUtil.isFinalVariable | train | public static boolean isFinalVariable(DeclarationExpression declarationExpression, SourceCode sourceCode) {
if (isFromGeneratedSourceCode(declarationExpression)) {
return false;
}
List<Expression> variableExpressions = getVariableExpressions(declarationExpression);
if (!... | java | {
"resource": ""
} |
q2166 | AstUtil.isTrue | train | public static boolean isTrue(Expression expression) {
if (expression == null) {
return false;
}
if (expression instanceof PropertyExpression
&& classNodeImplementsType(((PropertyExpression) expression).getObjectExpression().getType(), Boolean.class)) {
... | java | {
"resource": ""
} |
q2167 | AstUtil.isFalse | train | public static boolean isFalse(Expression expression) {
if (expression == null) {
return false;
}
if (expression instanceof PropertyExpression && classNodeImplementsType(((PropertyExpression) expression).getObjectExpression().getType(), Boolean.class)) {
if (((Propert... | java | {
"resource": ""
} |
q2168 | AstUtil.respondsTo | train | public static boolean respondsTo(Object object, String methodName) {
MetaClass metaClass = DefaultGroovyMethods.getMetaClass(object);
if (!metaClass.respondsTo(object, methodName).isEmpty()) {
return true;
}
Map properties = DefaultGroovyMethods.getProperties(object);
... | java | {
"resource": ""
} |
q2169 | AstUtil.classNodeImplementsType | train | public static boolean classNodeImplementsType(ClassNode node, Class target) {
ClassNode targetNode = ClassHelper.make(target);
if (node.implementsInterface(targetNode)) {
return true;
}
if (node.isDerivedFrom(targetNode)) {
return true;
}
i... | java | {
"resource": ""
} |
q2170 | AstUtil.isClosureDeclaration | train | public static boolean isClosureDeclaration(ASTNode expression) {
if (expression instanceof DeclarationExpression) {
if (((DeclarationExpression) expression).getRightExpression() instanceof ClosureExpression) {
return true;
}
}
if (expression instance... | java | {
"resource": ""
} |
q2171 | AstUtil.getParameterNames | train | public static List<String> getParameterNames(MethodNode node) {
ArrayList<String> result = new ArrayList<String>();
if (node.getParameters() != null) {
for (Parameter parameter : node.getParameters()) {
result.add(parameter.getName());
}
}
... | java | {
"resource": ""
} |
q2172 | AstUtil.getArgumentNames | train | public static List<String> getArgumentNames(MethodCallExpression methodCall) {
ArrayList<String> result = new ArrayList<String>();
Expression arguments = methodCall.getArguments();
List<Expression> argExpressions = null;
if (arguments instanceof ArrayExpression) {
argE... | java | {
"resource": ""
} |
q2173 | AstUtil.isSafe | train | public static boolean isSafe(Expression expression) {
if (expression instanceof MethodCallExpression) {
return ((MethodCallExpression) expression).isSafe();
}
if (expression instanceof PropertyExpression) {
return ((PropertyExpression) expression).isSafe();
... | java | {
"resource": ""
} |
q2174 | AstUtil.isSpreadSafe | train | public static boolean isSpreadSafe(Expression expression) {
if (expression instanceof MethodCallExpression) {
return ((MethodCallExpression) expression).isSpreadSafe();
}
if (expression instanceof PropertyExpression) {
return ((PropertyExpression) expression).isSprea... | java | {
"resource": ""
} |
q2175 | AstUtil.isMethodNode | train | public static boolean isMethodNode(ASTNode node, String methodNamePattern, Integer numArguments, Class returnType) {
if (!(node instanceof MethodNode)) {
return false;
}
if (!(((MethodNode) node).getName().matches(methodNamePattern))) {
return false;
}
... | java | {
"resource": ""
} |
q2176 | AstUtil.isVariable | train | public static boolean isVariable(ASTNode expression, String pattern) {
return (expression instanceof VariableExpression && ((VariableExpression) expression).getName().matches(pattern));
} | java | {
"resource": ""
} |
q2177 | AstUtil.getClassForClassNode | train | private static Class getClassForClassNode(ClassNode type) {
// todo hamlet - move to a different "InferenceUtil" object
Class primitiveType = getPrimitiveType(type);
if (primitiveType != null) {
return primitiveType;
} else if (classNodeImplementsType(type, String.class)... | java | {
"resource": ""
} |
q2178 | AstUtil.findFirstNonAnnotationLine | train | public static int findFirstNonAnnotationLine(ASTNode node, SourceCode sourceCode) {
if (node instanceof AnnotatedNode && !((AnnotatedNode) node).getAnnotations().isEmpty()) {
// HACK: Groovy line numbers are broken when annotations have a parameter :(
// so we must look at the lineN... | java | {
"resource": ""
} |
q2179 | AbstractAstVisitor.isFirstVisit | train | protected boolean isFirstVisit(Object expression) {
if (visited.contains(expression)) {
return false;
}
visited.add(expression);
return true;
} | java | {
"resource": ""
} |
q2180 | AbstractAstVisitor.sourceLineTrimmed | train | protected String sourceLineTrimmed(ASTNode node) {
return sourceCode.line(AstUtil.findFirstNonAnnotationLine(node, sourceCode) - 1);
} | java | {
"resource": ""
} |
q2181 | AbstractAstVisitor.sourceLine | train | protected String sourceLine(ASTNode node) {
return sourceCode.getLines().get(AstUtil.findFirstNonAnnotationLine(node, sourceCode) - 1);
} | java | {
"resource": ""
} |
q2182 | SlackHttpClient.buildJsonResponse | train | @Deprecated
public static <T> T buildJsonResponse(Response response, Class<T> clazz) throws IOException, SlackApiException {
if (response.code() == 200) {
String body = response.body().string();
DETAILED_LOGGER.accept(new HttpResponseListener.State(SlackConfig.DEFAULT, response, body... | java | {
"resource": ""
} |
q2183 | Slack.send | train | public WebhookResponse send(String url, Payload payload) throws IOException {
SlackHttpClient httpClient = getHttpClient();
Response httpResponse = httpClient.postJsonPostRequest(url, payload);
String body = httpResponse.body().string();
httpClient.runHttpResponseListeners(httpResponse, ... | java | {
"resource": ""
} |
q2184 | RTMClient.updateSession | train | private void updateSession(Session newSession) {
if (this.currentSession == null) {
this.currentSession = newSession;
} else {
synchronized (this.currentSession) {
this.currentSession = newSession;
}
}
} | java | {
"resource": ""
} |
q2185 | RTMEventHandler.getEventClass | train | public Class<E> getEventClass() {
if (cachedClazz != null) {
return cachedClazz;
}
Class<?> clazz = this.getClass();
while (clazz != Object.class) {
try {
Type mySuperclass = clazz.getGenericSuperclass();
Type tType = ((Parameterize... | java | {
"resource": ""
} |
q2186 | AbstractSpringFieldTagProcessor.computeId | train | protected final String computeId(
final ITemplateContext context,
final IProcessableElementTag tag,
final String name, final boolean sequence) {
String id = tag.getAttributeValue(this.idAttributeDefinition.getAttributeName());
if (!org.thymeleaf.util.StringUtils.isEm... | java | {
"resource": ""
} |
q2187 | Themes.code | train | public String code(final String code) {
if (this.theme == null) {
throw new TemplateProcessingException("Theme cannot be resolved because RequestContext was not found. "
+ "Are you using a Context object without a RequestContext variable?");
}
return this.theme.getMes... | java | {
"resource": ""
} |
q2188 | ManagedServerBootCmdFactory.resolveDirectoryGrouping | train | private static DirectoryGrouping resolveDirectoryGrouping(final ModelNode model, final ExpressionResolver expressionResolver) {
try {
return DirectoryGrouping.forName(HostResourceDefinition.DIRECTORY_GROUPING.resolveModelAttribute(expressionResolver, model).asString());
} catch (OperationFai... | java | {
"resource": ""
} |
q2189 | ManagedServerBootCmdFactory.addPathProperty | train | private String addPathProperty(final List<String> command, final String typeName, final String propertyName, final Map<String, String> properties, final DirectoryGrouping directoryGrouping,
final File typeDir, File serverDir) {
final String result;
final String value =... | java | {
"resource": ""
} |
q2190 | LoggingProfileDeploymentProcessor.findLoggingProfile | train | private String findLoggingProfile(final ResourceRoot resourceRoot) {
final Manifest manifest = resourceRoot.getAttachment(Attachments.MANIFEST);
if (manifest != null) {
final String loggingProfile = manifest.getMainAttributes().getValue(LOGGING_PROFILE);
if (loggingProfile != nul... | java | {
"resource": ""
} |
q2191 | ArgumentValueState.getBytesToken | train | public static int getBytesToken(ParsingContext ctx) {
String input = ctx.getInput().substring(ctx.getLocation());
int tokenOffset = 0;
int i = 0;
char[] inputChars = input.toCharArray();
for (; i < input.length(); i += 1) {
char c = inputChars[i];
if (c ==... | java | {
"resource": ""
} |
q2192 | RbacSanityCheckOperation.addOperation | train | public static void addOperation(final OperationContext context) {
RbacSanityCheckOperation added = context.getAttachment(KEY);
if (added == null) {
// TODO support managed domain
if (!context.isNormalServer()) return;
context.addStep(createOperation(), INSTANCE, Stage... | java | {
"resource": ""
} |
q2193 | Operations.getFailureDescription | train | public static ModelNode getFailureDescription(final ModelNode result) {
if (isSuccessfulOutcome(result)) {
throw ControllerClientLogger.ROOT_LOGGER.noFailureDescription();
}
if (result.hasDefined(FAILURE_DESCRIPTION)) {
return result.get(FAILURE_DESCRIPTION);
}
... | java | {
"resource": ""
} |
q2194 | Operations.getOperationAddress | train | public static ModelNode getOperationAddress(final ModelNode op) {
return op.hasDefined(OP_ADDR) ? op.get(OP_ADDR) : new ModelNode();
} | java | {
"resource": ""
} |
q2195 | Operations.getOperationName | train | public static String getOperationName(final ModelNode op) {
if (op.hasDefined(OP)) {
return op.get(OP).asString();
}
throw ControllerClientLogger.ROOT_LOGGER.operationNameNotFound();
} | java | {
"resource": ""
} |
q2196 | Operations.createReadResourceOperation | train | public static ModelNode createReadResourceOperation(final ModelNode address, final boolean recursive) {
final ModelNode op = createOperation(READ_RESOURCE_OPERATION, address);
op.get(RECURSIVE).set(recursive);
return op;
} | java | {
"resource": ""
} |
q2197 | DefaultOperationRequestBuilder.buildRequest | train | public ModelNode buildRequest() throws OperationFormatException {
ModelNode address = request.get(Util.ADDRESS);
if(prefix.isEmpty()) {
address.setEmptyList();
} else {
Iterator<Node> iterator = prefix.iterator();
while (iterator.hasNext()) {
... | java | {
"resource": ""
} |
q2198 | ManagementXml_5.parseUsersAuthentication | train | private void parseUsersAuthentication(final XMLExtendedStreamReader reader,
final ModelNode realmAddress, final List<ModelNode> list)
throws XMLStreamException {
final ModelNode usersAddress = realmAddress.clone().add(AUTHENTICATION, USERS);
list.add... | java | {
"resource": ""
} |
q2199 | JmxAction.getActionEffects | train | public Set<Action.ActionEffect> getActionEffects() {
switch(getImpact()) {
case CLASSLOADING:
case WRITE:
return WRITES;
case READ_ONLY:
return READS;
default:
throw new IllegalStateException();
}
} | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.