code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
public Short getShort(Map<String, Object> data, String name) {
return get(data, name, Short.class);
} | java |
protected Method findGetter(Object data, String property) throws IntrospectionException {
Class<?> clazz = getClass(data);
String key = clazz.getName() + ":" + property;
Method method = methods.get(key);
if (method == null) {
Method newMethod = null;
PropertyDescriptor[] props = Introspector... | java |
public final int getReadIndex(String property) {
MethodInfo method = propertyReadMethods.get(property);
return (null == method) ? -1 : method.index;
} | java |
public final Class<?> getPropertyType(String property) {
MethodInfo info = propertyWriteMethods.get(property);
if (null == info) return null;
else return info.parameterTypes[0];
} | java |
public final int getWriteIndex(String property) {
MethodInfo method = propertyWriteMethods.get(property);
return (null == method) ? -1 : method.index;
} | java |
public final int getIndex(String name, Object... args) {
Integer defaultIndex = methodIndexs.get(name);
if (null != defaultIndex) return defaultIndex.intValue();
else {
final List<MethodInfo> exists = methods.get(name);
if (null != exists) {
for (MethodInfo info : exists)
if (i... | java |
public final List<MethodInfo> getMethods(String name) {
List<MethodInfo> namedMethod = methods.get(name);
if (null == namedMethod) return Collections.emptyList();
else return namedMethod;
} | java |
public final List<MethodInfo> getMethods() {
List<MethodInfo> methodInfos = CollectUtils.newArrayList();
for (Map.Entry<String, List<MethodInfo>> entry : methods.entrySet()) {
for (MethodInfo info : entry.getValue())
methodInfos.add(info);
}
Collections.sort(methodInfos);
return method... | java |
public static <T> List<T> getAll(Collection<Option<T>> values) {
List<T> results = CollectUtils.newArrayList(values.size());
for (Option<T> op : values) {
if (op.isDefined()) results.add(op.get());
}
return results;
} | java |
public static List<Method> getBeanSetters(Class<?> clazz) {
List<Method> methods = CollectUtils.newArrayList();
for (Method m : clazz.getMethods()) {
if (m.getName().startsWith("set") && m.getName().length() > 3) {
if (Modifier.isPublic(m.getModifiers()) && !Modifier.isStatic(m.getModifiers())
... | java |
protected List<ResultConfig> buildResultConfigs(Class<?> clazz, PackageConfig.Builder pcb) {
List<ResultConfig> configs = CollectUtils.newArrayList();
// load annotation results
Result[] results = new Result[0];
Results rs = clazz.getAnnotation(Results.class);
if (null == rs) {
org.beangle.str... | java |
public Stopwatch start() {
Assert.isTrue(!isRunning);
isRunning = true;
startTick = ticker.read();
return this;
} | java |
protected void populateValue(Object entity, EntityType type, String attr, Object value) {
// 当有深层次属性
if (Strings.contains(attr, '.')) {
if (null != foreignerKeys) {
boolean isForeigner = isForeigner(attr);
// 如果是个外键,先根据parentPath生成新的外键实体。
// 因此导入的是外键,只能有一个属性导入.
if (isForeig... | java |
@SuppressWarnings("rawtypes")
protected ModelFactory getModelFactory(Class clazz) {
if (altMapWrapper && Map.class.isAssignableFrom(clazz)) { return FriendlyMapModel.FACTORY; }
return super.getModelFactory(clazz);
} | java |
protected final Pair<?, ?> entry(Object key, Object value) {
return Pair.of(key, value);
} | java |
protected final Definition bean(Class<?> clazz) {
Definition def = new Definition(clazz.getName(), clazz, Scope.SINGLETON.toString());
def.beanName = clazz.getName() + "#" + Math.abs(System.identityHashCode(def));
return def;
} | java |
protected Option<TextBundle> loadJavaBundle(String bundleName, Locale locale) {
Properties properties = new Properties();
String resource = toJavaResourceName(bundleName, locale);
try {
InputStream is = ClassLoaders.getResourceAsStream(resource, getClass());
if (null == is) return Option.none();... | java |
protected final String toJavaResourceName(String bundleName, Locale locale) {
String fullName = bundleName;
final String localeName = toLocaleStr(locale);
final String suffix = "properties";
if (!"".equals(localeName)) fullName = fullName + "_" + localeName;
StringBuilder sb = new StringBuilder(full... | java |
private String getComponentName() {
Class<?> c = getClass();
String name = c.getName();
int dot = name.lastIndexOf('.');
return name.substring(dot + 1).toLowerCase();
} | java |
protected Stack<Component> getComponentStack() {
@SuppressWarnings("unchecked")
Stack<Component> componentStack = (Stack<Component>) stack.getContext().get(COMPONENT_STACK);
if (componentStack == null) {
componentStack = new Stack<Component>();
stack.getContext().put(COMPONENT_STACK, componentSt... | java |
@SuppressWarnings("unchecked")
protected <T extends Component> T findAncestor(Class<T> clazz) {
Stack<? extends Component> componentStack = getComponentStack();
for (int i = componentStack.size() - 2; i >= 0; i--) {
Component component = componentStack.get(i);
if (clazz.equals(component.getClass()... | java |
public static List<String> readLines(File file, Charset charset) throws IOException {
InputStream in = null;
try {
in = new FileInputStream(file);
if (null == charset) {
return IOs.readLines(new InputStreamReader(in));
} else {
InputStreamReader reader = new InputStreamReader(i... | java |
public String getParamstring() {
StringWriter sw = new StringWriter();
Enumeration<?> em = req.getParameterNames();
while (em.hasMoreElements()) {
String attr = (String) em.nextElement();
if (attr.equals("method")) continue;
String value = req.getParameter(attr);
if (attr.equals("x-r... | java |
protected void error(String message, Element source, Throwable cause) {
logger.error(message);
} | java |
protected void checkNameUniqueness(String beanName, List<String> aliases, Element beanElement) {
String foundName = null;
if (StringUtils.hasText(beanName) && this.usedNames.contains(beanName)) foundName = beanName;
if (foundName == null) foundName = (String) CollectionUtils.findFirstMatch(this.usedNames,... | java |
protected AbstractBeanDefinition createBeanDefinition(String className, String parentName)
throws ClassNotFoundException {
return BeanDefinitionReaderUtils.createBeanDefinition(parentName, className, null);
} | java |
public void parseConstructorArgElements(Element beanEle, BeanDefinition bd) {
NodeList nl = beanEle.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
if (node instanceof Element && nodeNameEquals(node, CONSTRUCTOR_ARG_ELEMENT))
parseConstructorArgElement((El... | java |
public void parsePropertyElements(Element beanEle, BeanDefinition bd) {
NodeList nl = beanEle.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
if (node instanceof Element && nodeNameEquals(node, PROPERTY_ELEMENT))
parsePropertyElement((Element) node, bd);
... | java |
public void parseQualifierElements(Element beanEle, AbstractBeanDefinition bd) {
NodeList nl = beanEle.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
if (node instanceof Element && nodeNameEquals(node, QUALIFIER_ELEMENT))
parseQualifierElement((Element) n... | java |
public void parseLookupOverrideSubElements(Element beanEle, MethodOverrides overrides) {
NodeList nl = beanEle.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
if (node instanceof Element && nodeNameEquals(node, LOOKUP_METHOD_ELEMENT)) {
Element ele = (Elem... | java |
public void parseReplacedMethodSubElements(Element beanEle, MethodOverrides overrides) {
NodeList nl = beanEle.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
if (node instanceof Element && nodeNameEquals(node, REPLACED_METHOD_ELEMENT)) {
Element replacedM... | java |
public void parseConstructorArgElement(Element ele, BeanDefinition bd) {
String indexAttr = ele.getAttribute(INDEX_ATTRIBUTE);
String typeAttr = ele.getAttribute(TYPE_ATTRIBUTE);
String nameAttr = ele.getAttribute(NAME_ATTRIBUTE);
if (StringUtils.hasLength(indexAttr)) {
try {
int index = I... | java |
public void parsePropertyElement(Element ele, BeanDefinition bd) {
String propertyName = ele.getAttribute(NAME_ATTRIBUTE);
if (!StringUtils.hasLength(propertyName)) {
error("Tag 'property' must have a 'name' attribute", ele);
return;
}
this.parseState.push(new PropertyEntry(propertyName));
... | java |
public void parseQualifierElement(Element ele, AbstractBeanDefinition bd) {
String typeName = ele.getAttribute(TYPE_ATTRIBUTE);
if (!StringUtils.hasLength(typeName)) {
error("Tag 'qualifier' must have a 'type' attribute", ele);
return;
}
this.parseState.push(new QualifierEntry(typeName));
... | java |
public Object parsePropertyValue(Element ele, BeanDefinition bd, String propertyName) {
String elementName = (propertyName != null) ? "<property> element for property '" + propertyName + "'"
: "<constructor-arg> element";
// Should only have one child element: ref, value, list, etc.
NodeList nl = e... | java |
public Object parsePropertySubElement(Element ele, BeanDefinition bd, String defaultValueType) {
if (!isDefaultNamespace(getNamespaceURI(ele))) {
error("Cannot support nested element .", ele);
return null;
} else if (nodeNameEquals(ele, BEAN_ELEMENT)) {
BeanDefinitionHolder nestedBd = parseBea... | java |
public Object parseIdRefElement(Element ele) {
// A generic reference to any name of any bean.
String refName = ele.getAttribute(BEAN_REF_ATTRIBUTE);
if (!StringUtils.hasLength(refName)) {
// A reference to the id of another bean in the same XML file.
refName = ele.getAttribute(LOCAL_REF_ATTRIBU... | java |
public Object parseValueElement(Element ele, String defaultTypeName) {
// It's a literal value.
String value = DomUtils.getTextValue(ele);
String specifiedTypeName = ele.getAttribute(TYPE_ATTRIBUTE);
String typeName = specifiedTypeName;
if (!StringUtils.hasText(typeName)) typeName = defaultTypeName;... | java |
public Object parseArrayElement(Element arrayEle, BeanDefinition bd) {
String elementType = arrayEle.getAttribute(VALUE_TYPE_ATTRIBUTE);
NodeList nl = arrayEle.getChildNodes();
ManagedArray target = new ManagedArray(elementType, nl.getLength());
target.setSource(extractSource(arrayEle));
target.setE... | java |
public List<Object> parseListElement(Element collectionEle, BeanDefinition bd) {
String defaultElementType = collectionEle.getAttribute(VALUE_TYPE_ATTRIBUTE);
NodeList nl = collectionEle.getChildNodes();
ManagedList<Object> target = new ManagedList<Object>(nl.getLength());
target.setSource(extractSource... | java |
public Set<Object> parseSetElement(Element collectionEle, BeanDefinition bd) {
String defaultElementType = collectionEle.getAttribute(VALUE_TYPE_ATTRIBUTE);
NodeList nl = collectionEle.getChildNodes();
ManagedSet<Object> target = new ManagedSet<Object>(nl.getLength());
target.setSource(extractSource(col... | java |
protected Object parseKeyElement(Element keyEle, BeanDefinition bd, String defaultKeyTypeName) {
NodeList nl = keyEle.getChildNodes();
Element subElement = null;
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
if (node instanceof Element) {
// Child element is what we'... | java |
public Properties parsePropsElement(Element propsEle) {
ManagedProperties props = new ManagedProperties();
props.setSource(extractSource(propsEle));
props.setMergeEnabled(parseMergeAttribute(propsEle));
List<Element> propEles = DomUtils.getChildElementsByTagName(propsEle, PROP_ELEMENT);
for (Elemen... | java |
public boolean parseMergeAttribute(Element collectionElement) {
String value = collectionElement.getAttribute(MERGE_ATTRIBUTE);
return TRUE_VALUE.equals(value);
} | java |
public final void init(FilterConfig filterConfig) throws ServletException {
Assert.notNull(filterConfig, "FilterConfig must not be null");
logger.debug("Initializing filter '{}'", filterConfig.getFilterName());
this.filterConfig = filterConfig;
initParams(filterConfig);
// Let subclasses do whateve... | java |
private Class<?> getPropertyType(PersistentClass pc, String propertyString) {
String[] properties = split(propertyString, '.');
Property p = pc.getProperty(properties[0]);
Component cp = ((Component) p.getValue());
int i = 1;
for (; i < properties.length; i++) {
p = cp.getProperty(properties[i... | java |
protected final <T> T getId(String name, Class<T> clazz) {
Object[] entityIds = getAll(name + ".id");
if (Arrays.isEmpty(entityIds)) entityIds = getAll(name + "Id");
if (Arrays.isEmpty(entityIds)) entityIds = getAll("id");
if (Arrays.isEmpty(entityIds)) return null;
else {
String entityId = en... | java |
protected final <T> T[] getIds(String name, Class<T> clazz) {
T[] datas = Params.getAll(name + ".id", clazz);
if (null == datas) {
String datastring = Params.get(name + ".ids");
if (null == datastring) datastring = Params.get(name + "Ids");
if (null == datastring) Array.newInstance(clazz, 0);
... | java |
@Override
public void evict(K key) {
Object existed = store.getIfPresent(key);
if (null != existed) store.invalidate(key);
} | java |
public String constructLocalLoginServiceUrl(final HttpServletRequest request,
final HttpServletResponse response, final String service, final String serverName,
final String artifactParameterName, final boolean encode) {
if (Strings.isNotBlank(service)) return encode ? response.encodeURL(service) : serv... | java |
public String constructServiceUrl(final HttpServletRequest request, final HttpServletResponse response,
final String service, final String serverName) {
if (Strings.isNotBlank(service)) { return response.encodeURL(service); }
final StringBuilder buffer = new StringBuilder();
if (!serverName.startsWit... | java |
public String constructRedirectUrl(final String casServerLoginUrl, final String serviceParameterName,
final String serviceUrl, final boolean renew, final boolean gateway) {
try {
return casServerLoginUrl + (casServerLoginUrl.indexOf("?") != -1 ? "&" : "?") + serviceParameterName
+ "=" + URLEnc... | java |
@Override
public Resource createRelative(String relativePath) {
String pathToUse = StringUtils.applyRelativePath(this.path, relativePath);
return new ServletContextResource(this.servletContext, pathToUse);
} | java |
public static byte[] join(List<byte[]> arrays) {
int maxlength = 0;
for (byte[] array : arrays) {
maxlength += array.length;
}
byte[] rs = new byte[maxlength];
int pos = 0;
for (byte[] array : arrays) {
System.arraycopy(array, 0, rs, pos, array.length);
pos += array.length;
... | java |
public ActionMapping getMapping(HttpServletRequest request, ConfigurationManager configManager) {
ActionMapping mapping = new ActionMapping();
parseNameAndNamespace(RequestUtils.getServletPath(request), mapping);
String method = request.getParameter(MethodParam);
if (Strings.isNotEmpty(method)) mapping... | java |
public String encode(String value) {
if (value == null) { return null; }
StringBuilder buffer = new StringBuilder();
buffer.append(Prefix);
buffer.append(charset);
buffer.append(Sep);
buffer.append(getEncoding());
buffer.append(Sep);
buffer.append(new String(Base64.encode(value.getBytes(... | java |
public String decode(String text) {
if (text == null) { return null; }
if ((!text.startsWith(Prefix)) || (!text.endsWith(Postfix)))
throw new IllegalArgumentException("RFC 1522 violation: malformed encoded content");
int terminator = text.length() - 2;
int from = 2;
int to = text.indexOf(Sep, ... | java |
public static Cookie getCookie(HttpServletRequest request, String name) {
Cookie[] cookies = request.getCookies();
Cookie returnCookie = null;
if (cookies == null) { return returnCookie; }
for (int i = 0; i < cookies.length; i++) {
Cookie thisCookie = cookies[i];
if (thisCookie.getName().eq... | java |
public static void deleteCookie(HttpServletResponse response, Cookie cookie, String path) {
if (cookie != null) {
// Delete the cookie by setting its maximum age to zero
cookie.setMaxAge(0);
cookie.setPath(path);
response.addCookie(cookie);
}
} | java |
private long lastModified(URL url) {
if (url.getProtocol().equals("file")) {
return new File(url.getFile()).lastModified();
} else {
try {
URLConnection conn = url.openConnection();
if (conn instanceof JarURLConnection) {
URL jarURL = ((JarURLConnection) conn).getJarFileURL... | java |
protected String processLabel(String label, String name) {
if (null != label) {
if (Strings.isEmpty(label)) return null;
else return getText(label);
} else return getText(name);
} | java |
public String edit() {
Entity<?> entity = getEntity();
put(getShortName(), entity);
editSetting(entity);
return forward();
} | java |
private int findIndexOfFrom(String query) {
if (query.startsWith("from")) return 0;
int fromIdx = query.indexOf(" from ");
if (-1 == fromIdx) return -1;
final int first = query.substring(0, fromIdx).indexOf("(");
if (first > 0) {
int leftCnt = 1;
int i = first + 1;
while (leftCnt !... | java |
private TraversableCodeGenStrategy getTraversableStrategy(JType rawType, Map<String,JClass> directClasses) {
if (rawType.isPrimitive()) {
// primitive types are never traversable
return TraversableCodeGenStrategy.NO;
}
JClass clazz = (JClass) rawType;
if (clazz.i... | java |
public static Os parse(String agentString) {
if (Strings.isEmpty(agentString)) { return Os.UNKNOWN; }
for (OsCategory category : OsCategory.values()) {
String version = category.match(agentString);
if (version != null) {
String key = category.getName() + "/" + version;
Os os = osMap.... | java |
private Template getTemplate(String templateName) throws ParseException {
try {
return config.getTemplate(templateName, "UTF-8");
} catch (ParseException e) {
throw e;
} catch (IOException e) {
logger.error("Couldn't load template '{}',loader is {}", templateName,
config.getTempl... | java |
@SuppressWarnings("unchecked")
public <T extends R> Converter<S, T> getConverter(Class<T> targetType) {
return (Converter<S, T>) converters.get(targetType);
} | java |
public int getIndex(String expression) {
if (expression == null || expression.length() == 0) { return -1; }
for (int i = 0; i < expression.length(); i++) {
char c = expression.charAt(i);
if (c == Nested || c == MappedStart) {
return -1;
} else if (c == IndexedStart) {
int end =... | java |
public String getProperty(String expression) {
if (expression == null || expression.length() == 0) { return expression; }
for (int i = 0; i < expression.length(); i++) {
char c = expression.charAt(i);
if (c == Nested) {
return expression.substring(0, i);
} else if (c == MappedStart || ... | java |
public boolean hasNested(String expression) {
if (expression == null || expression.length() == 0) return false;
else return remove(expression) != null;
} | java |
public boolean isIndexed(String expression) {
if (expression == null || expression.length() == 0) { return false; }
for (int i = 0; i < expression.length(); i++) {
char c = expression.charAt(i);
if (c == Nested || c == MappedStart) {
return false;
} else if (c == IndexedStart) { return... | java |
public String next(String expression) {
if (expression == null || expression.length() == 0) { return null; }
boolean indexed = false;
boolean mapped = false;
for (int i = 0; i < expression.length(); i++) {
char c = expression.charAt(i);
if (indexed) {
if (c == IndexedEnd) { return ex... | java |
public String remove(String expression) {
if (expression == null || expression.length() == 0) { return null; }
String property = next(expression);
if (expression.length() == property.length()) { return null; }
int start = property.length();
if (expression.charAt(start) == Nested) start++;
return... | java |
public void initFrom(SessionFactory sessionFactory) {
Assert.notNull(sessionFactory);
Stopwatch watch = new Stopwatch().start();
Map<String, ClassMetadata> classMetadatas = sessionFactory.getAllClassMetadata();
int entityCount = entityTypes.size();
int collectionCount = collectionTypes.size();
f... | java |
public Object put(Object key, Object value) {
return next.put(key, value);
} | java |
public static int count(final String host, final char charactor) {
int count = 0;
for (int i = 0; i < host.length(); i++) {
if (host.charAt(i) == charactor) {
count++;
}
}
return count;
} | java |
public static int count(final String host, final String searchStr) {
int count = 0;
for (int startIndex = 0; startIndex < host.length(); startIndex++) {
int findLoc = host.indexOf(searchStr, startIndex);
if (findLoc == -1) {
break;
} else {
count++;
startIndex = findLoc... | java |
protected static String getFileName(String file_name) {
if (file_name == null) return "";
file_name = file_name.trim();
int iPos = 0;
iPos = file_name.lastIndexOf("\\");
if (iPos > -1) file_name = file_name.substring(iPos + 1);
iPos = file_name.lastIndexOf("/");
if (iPos > -1) file_name = f... | java |
public boolean isMultiSchema() {
Set<String> schemas = CollectUtils.newHashSet();
for (TableNamePattern pattern : patterns) {
schemas.add((null == pattern.getSchema()) ? "" : pattern.getSchema());
}
return schemas.size() > 1;
} | java |
public static void setActive(boolean active) {
if (active) System.setProperty(ACTIVATE_PROPERTY, "true");
else System.clearProperty(ACTIVATE_PROPERTY);
TimerTrace.active = active;
} | java |
public void findStaticResource(String path, HttpServletRequest request, HttpServletResponse response)
throws IOException {
processor.process(cleanupPath(path), request, response);
} | java |
public List<String> getBeanNames(Class<?> type) {
if (typeNames.containsKey(type)) { return typeNames.get(type); }
List<String> names = CollectUtils.newArrayList();
for (Map.Entry<String, Class<?>> entry : nameTypes.entrySet()) {
if (type.isAssignableFrom(entry.getValue())) {
names.add(entry.g... | java |
public ObjectAndType initProperty(final Object target, Type type, final String attr) {
Object propObj = target;
Object property = null;
int index = 0;
String[] attrs = Strings.split(attr, ".");
while (index < attrs.length) {
try {
property = getProperty(propObj, attrs[index]);
... | java |
public static Browser parse(final String agentString) {
if (Strings.isEmpty(agentString)) { return Browser.UNKNOWN; }
// first consider engine
for (Engine engine : Engine.values()) {
String egineName = engine.name;
if (agentString.contains(egineName)) {
for (BrowserCategory category : en... | java |
public boolean requireScreenshot(final ExtendedSeleniumCommand command,
boolean result) {
return
(!command.isAssertCommand()
&& !command.isVerifyCommand()
&& !command.isWaitForCommand()
&& screenshotPolicy == ScreenshotPolicy.STEP)
|| (!result
&& (screenshotPolicy == ScreenshotPolicy.FAILURE
... | java |
private void setTimeoutOnSelenium() {
executeCommand("setTimeout", new String[] { "" + this.timeout });
WebDriver.Timeouts timeouts = getWebDriver().manage().timeouts();
timeouts.setScriptTimeout(this.timeout, TimeUnit.MILLISECONDS);
timeouts.pageLoadTimeout(this.timeout, TimeUnit.MILLISECONDS... | java |
public void addAliasForLocator(String alias, String locator) {
LOG.info("Add alias: '" + alias + "' for '" + locator + "'");
aliases.put(alias, locator);
} | java |
public void startSeleniumServer(final String args) {
if (seleniumProxy != null) {
throw new IllegalStateException("There is already a Selenium remote server running");
}
try {
final RemoteControlConfiguration configuration;
LOG.info("Starting server with arguments: '" + args + "'"... | java |
private Transactional readAnnotation(MethodInvocation invocation)
{
final Method method = invocation.getMethod();
if (method.isAnnotationPresent(Transactional.class))
{
return method.getAnnotation(Transactional.class);
}
else
{
throw new RuntimeException("Could not find Transactional annotation");
... | java |
private final void complete(Transaction tx, boolean readOnly)
{
if (log.isTraceEnabled())
log.trace("Complete " + tx);
if (!readOnly)
tx.commit();
else
tx.rollback();
} | java |
private Connection getConnection(final ICommandLine cl) throws SQLException, InstantiationException, IllegalAccessException,
ClassNotFoundException {
String database = DEFAULT_TABLE;
if (cl.hasOption("database")) {
database = cl.getOptionValue("database");
}
Strin... | java |
protected void configureThresholdEvaluatorBuilder(final ThresholdsEvaluatorBuilder thrb, final ICommandLine cl) throws BadThresholdException {
if (cl.hasOption("th")) {
for (Object obj : cl.getOptionValues("th")) {
thrb.withThreshold(obj.toString());
}
}
} | java |
private boolean evaluate(final Metric metric, final Prefixes prefix) {
if (metric == null || metric.getMetricValue() == null) {
throw new NullPointerException("Value can't be null");
}
BigDecimal value = metric.getMetricValue(prefix);
if (!isNegativeInfinity()) {
... | java |
public final ReturnValue execute(final ICommandLine cl) {
File fProcessFile = new File(cl.getOptionValue("executable"));
StreamManager streamMgr = new StreamManager();
if (!fProcessFile.exists()) {
return new ReturnValue(Status.UNKNOWN, "Could not exec executable : " + fProcessFile.... | java |
public static void configureFiles(Iterable<File> files)
{
for (File file : files)
{
if (file != null && file.exists() && file.canRead())
{
setup(file);
return;
}
}
System.out.println("(No suitable log config file found)");
} | java |
public Set<CommandDefinition> getAllCommandDefinition(final String pluginName) {
Set<CommandDefinition> res = new HashSet<CommandDefinition>();
for (CommandDefinition cd : commandDefinitionsMap.values()) {
if (cd.getPluginName().equals(pluginName)) {
res.add(cd);
... | java |
public synchronized void initialiseFromAPIToken(final String token)
{
final String responseStr = authService.getToken(UserManagerOAuthService.GRANT_TYPE_TOKEN_EXCHANGE,
null,
getOwnCallbackUri().toString(),
... | java |
public URI getOwnCallbackUri()
{
String localEndpointStr = (oauthSelfEndpoint != null) ? oauthSelfEndpoint : localEndpoint.toString();
if (!localEndpointStr.endsWith("/"))
localEndpointStr += "/";
return URI.create(localEndpointStr + "oauth2/client/cb");
} | java |
public URI getAuthFlowStartEndpoint(final String returnTo, final String scope)
{
final String oauthServiceRoot = (oauthServiceRedirectEndpoint != null) ?
oauthServiceRedirectEndpoint :
oauthServiceEndpoint;
final String endpoint = oauthServiceRoot... | java |
public URI getRedirectToFromState(final String state)
{
final String[] pieces = decodeState(state).split(" ", 2);
if (!StringUtils.equals(callbackNonce, pieces[0]))
{
// The callback nonce is not what we expect; this is usually caused by:
// - The user has followed a previous oauth callback entry from the... | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.