id
stringlengths
7
14
text
stringlengths
1
106k
1644585_8
public String getName() { return name; }
1644585_9
public String getValue() { return value; }
1645877_0
public InputStream getInputStream() { try { if (logger.isInfoEnabled()) logger.info("loading stream " + getResourceName()); return new FileInputStream(new File(path)); } catch (FileNotFoundException e) { throw new RuntimeException("File for " + resourceName + " not found", e); } }
1645877_1
public InputStream getInputStream() { try { if (logger.isInfoEnabled()) logger.info("loading stream " + getResourceName()); return new FileInputStream(new File(path)); } catch (FileNotFoundException e) { throw new RuntimeException("File for " + resourceName + " not found", e); } }
1645877_2
public DataSource parse(String url) { if (url.startsWith("classpath://")) { String path = url.replaceAll("classpath://", ""); return DataSourceFactory.classPathDataSource(path); } if (url.startsWith("file://")) { String path = url.replaceAll("file://", ""); return DataSourceFactory.fileSystemDataSource(p...
1645877_3
public DataSource parse(String url) { if (url.startsWith("classpath://")) { String path = url.replaceAll("classpath://", ""); return DataSourceFactory.classPathDataSource(path); } if (url.startsWith("file://")) { String path = url.replaceAll("file://", ""); return DataSourceFactory.fileSystemDataSource(p...
1645877_4
public DataSource parse(String url) { if (url.startsWith("classpath://")) { String path = url.replaceAll("classpath://", ""); return DataSourceFactory.classPathDataSource(path); } if (url.startsWith("file://")) { String path = url.replaceAll("file://", ""); return DataSourceFactory.fileSystemDataSource(p...
1645877_5
public DataSource parse(String url) { if (url.startsWith("classpath://")) { String path = url.replaceAll("classpath://", ""); return DataSourceFactory.classPathDataSource(path); } if (url.startsWith("file://")) { String path = url.replaceAll("file://", ""); return DataSourceFactory.fileSystemDataSource(p...
1645877_6
@Override public InputStream getInputStream() { if (logger.isInfoEnabled()) logger.info("returning static input stream " + getResourceName()); return inputStream; }
1645877_7
@Override public String getResourceName() { return resourceName; }
1645877_8
public void load() { if (!isLoaded()) data = dataLoader.load(); }
1645877_9
public T get() { if (!isLoaded()) load(); return data; }
1658141_0
public String addContact(Contact contact) { String id = idGenerator.newId(); // Como el servicio de generación de ids puede proporcionar // ids repetidos, se debe comprobar si el id ya fue asignado. // Se podría implementar una lógica de reintentos, pero finalmente // decidimos que es mejo...
1658141_1
public String addContact(Contact contact) { String id = idGenerator.newId(); // Como el servicio de generación de ids puede proporcionar // ids repetidos, se debe comprobar si el id ya fue asignado. // Se podría implementar una lógica de reintentos, pero finalmente // decidimos que es mejo...
1658141_2
public Contact getContact(String contactId) { Contact result = addressBookMap.get(contactId); if(result == null) { throw new InvalidIdException(); } return result; }
1658141_3
public Contact getContact(String contactId) { Contact result = addressBookMap.get(contactId); if(result == null) { throw new InvalidIdException(); } return result; }
1658141_4
@Override public String addContact(Contact contact) { String id = idGenerator.newId(); // Como el servicio de generación de ids puede proporcionar // ids repetidos, se debe comprobar si el id ya fue asignado. // Se podría implementar una lógica de reintentos, pero finalmente // decidimos que es...
1658141_5
@Override public Contact getContact(String contactId) { Contact result = addressBookMap.get(contactId); if(result == null) { throw new InvalidIdException(); } return result; }
1658141_6
@Override public Contact getContact(String contactId) { Contact result = addressBookMap.get(contactId); if(result == null) { throw new InvalidIdException(); } return result; }
1658141_7
@Override public String addContact(Contact contact) { /* if (contact.getFirstName() == null || contact.getFirstName().trim().length() < 1) { throw new InvalidContactException(); } contact.setFirstName(contact.getFirstName().trim()); if (contact.getSurname() != null) { contact.setSur...
1658141_8
@Override public String addContact(Contact contact) { /* if (contact.getFirstName() == null || contact.getFirstName().trim().length() < 1) { throw new InvalidContactException(); } contact.setFirstName(contact.getFirstName().trim()); if (contact.getSurname() != null) { contact.setSur...
1658141_9
@Override public String addContact(Contact contact) { /* if (contact.getFirstName() == null || contact.getFirstName().trim().length() < 1) { throw new InvalidContactException(); } contact.setFirstName(contact.getFirstName().trim()); if (contact.getSurname() != null) { contact.setSur...
1660918_0
public static String shellifyOptionName(String name) { return Commands.shellifyOptionName(name); }
1660918_1
public static String shellifyOptionNameDashed(String name) { return Commands.shellifyOptionNameDashed(name); }
1660918_2
public static String shellifyOptionNameDashed(String name) { return Commands.shellifyOptionNameDashed(name); }
1660918_3
public static String shellifyOptionNameDashed(String name) { return Commands.shellifyOptionNameDashed(name); }
1660918_4
public static String shellifyOptionNameDashed(String name) { return Commands.shellifyOptionNameDashed(name); }
1660918_5
public static String shellifyOptionNameDashed(String name) { return Commands.shellifyOptionNameDashed(name); }
1660918_6
@Deprecated public void write(Model project, Document document, OutputStream stream) throws java.io.IOException { updateModel(project, "project", new Counter(0), document.getRootElement()); XMLOutputter outputter = new XMLOutputter(); outputter.setFormat(Format.getPrettyFormat().setIndent(" ").setLineSeparato...
1660918_7
@Deprecated public void write(Model project, Document document, OutputStream stream) throws java.io.IOException { updateModel(project, "project", new Counter(0), document.getRootElement()); XMLOutputter outputter = new XMLOutputter(); outputter.setFormat(Format.getPrettyFormat().setIndent(" ").setLineSeparato...
1660918_8
@Override public Set<Dependency> resolveDependencies(DependencyQuery query) { Set<Dependency> result = new HashSet<>(); Predicate<Dependency> filter = query.getDependencyFilter(); RepositorySystem system = container.getRepositorySystem(); Settings settings = container.getSettings(); DefaultRepositorySyst...
1660918_9
@Override public Set<Dependency> resolveDependencies(DependencyQuery query) { Set<Dependency> result = new HashSet<>(); Predicate<Dependency> filter = query.getDependencyFilter(); RepositorySystem system = container.getRepositorySystem(); Settings settings = container.getSettings(); DefaultRepositorySyst...
1666060_0
static Subscriber instantiateSubscriber(EPServiceProvider epService, SubscriberConfig subscriberConfig) throws InstantiationException, IllegalAccessException, InvocationTargetException { // The Esper runtime engine requires event names if (subscriberConfig.getEventOutputName() == null) { throw new I...
1666060_1
@VisibleForTesting static UpdateListener instantiateUpdateListener(final PublisherConfig publisherConfig) throws ClassNotFoundException, InstantiationException, IllegalAccessException, InvocationTargetException { final String listenerType = publisherConfig.getType(); final Class listenerClass = Class.forNam...
1666060_2
public double getAlpha() { return alpha; }
1670551_0
@Override public Query parse(final String query, final String defaultField) throws QueryNodeException { try { return (Query) super.parse(query, defaultField); } catch (final QueryNodeException e) { throw new ParseException("Query parsing failed", e); } }
1670551_1
@Override public Query parse(final String query, final String defaultField) throws QueryNodeException { try { return (Query) super.parse(query, defaultField); } catch (final QueryNodeException e) { throw new ParseException("Query parsing failed", e); } }
1670551_2
@Override public Query parse(final String query, final String defaultField) throws QueryNodeException { try { return (Query) super.parse(query, defaultField); } catch (final QueryNodeException e) { throw new ParseException("Query parsing failed", e); } }
1670551_3
@Override public Query parse(final String query, final String defaultField) throws QueryNodeException { try { return (Query) super.parse(query, defaultField); } catch (final QueryNodeException e) { throw new ParseException("Query parsing failed", e); } }
1670551_4
@Override public Query parse(final String query, final String defaultField) throws QueryNodeException { try { return (Query) super.parse(query, defaultField); } catch (final QueryNodeException e) { throw new ParseException("Query parsing failed", e); } }
1670551_5
@Override public Query parse(final String query, final String defaultField) throws QueryNodeException { try { return (Query) super.parse(query, defaultField); } catch (final QueryNodeException e) { throw new ParseException("Query parsing failed", e); } }
1670551_6
@Override public Query parse(final String query, final String defaultField) throws QueryNodeException { try { return (Query) super.parse(query, defaultField); } catch (final QueryNodeException e) { throw new ParseException("Query parsing failed", e); } }
1670551_7
@Override public Query parse(final String query, final String defaultField) throws QueryNodeException { try { return (Query) super.parse(query, defaultField); } catch (final QueryNodeException e) { throw new ParseException("Query parsing failed", e); } }
1670551_8
@Override public Query parse(final String query, final String defaultField) throws QueryNodeException { try { return (Query) super.parse(query, defaultField); } catch (final QueryNodeException e) { throw new ParseException("Query parsing failed", e); } }
1670551_9
@Override public Query parse(final String query, final String defaultField) throws QueryNodeException { try { return (Query) super.parse(query, defaultField); } catch (final QueryNodeException e) { throw new ParseException("Query parsing failed", e); } }
1672467_0
public static List<String> utf8byteSizeSplit(String s, int maxChunkBytes) { if (maxChunkBytes < 6) { throw new IllegalArgumentException("Max UTF-8 chunk size cannot be less than 6"); } byte[] bytes = s.getBytes(UTF8); List<String> result = new ArrayList<String>(); int chunkStartOffset = 0; ...
1676303_0
public final boolean isNetworkError() { return (getCause() != null) ? getCause() instanceof IOException : false; }
1676303_1
public List<OffendingRule> getOffendingRules() { return offendingRules; }
1676303_2
public List<OffendingRule> getOffendingRules() { return offendingRules; }
1676303_3
public boolean matches(final Rule rule) { return rule != null && ((offendingRule.getValue() == null && rule.getValue() == null) || (offendingRule.getValue() .equals(rule.getValue()))); }
1676303_4
public boolean matches(final Rule rule) { return rule != null && ((offendingRule.getValue() == null && rule.getValue() == null) || (offendingRule.getValue() .equals(rule.getValue()))); }
1676303_5
@Override public String toString() { /* * Outputs a json like the one gnip expects. * * You might say WTF, we are crafting the json string by hand. * Thats because its just a toString method, and because i don't * want extra dependencies. */ final StringBuilder sb = new StringBui...
1676303_6
@Override public String toString() { /* * Outputs a json like the one gnip expects. * * You might say WTF, we are crafting the json string by hand. * Thats because its just a toString method, and because i don't * want extra dependencies. */ final StringBuilder sb = new StringBui...
1676303_7
@Override public boolean equals(final java.lang.Object obj) { boolean ret = false; if(this == obj) { ret = true; } else if(obj instanceof Rule) { final Rule r = ((Rule)obj); ret = Objects.equals(value, r.value) && Objects.equals(tag, r.tag) && ...
1676303_8
@Override public URI createStreamUri(final String account, final String streamName, final Integer backfill) { if (account == null || account.trim().isEmpty()) { throw new IllegalArgumentException("The account cannot be null or empty"); } if (streamName == null || streamName.trim().isEmpty()) { ...
1676303_9
@Override public final Activity unmarshall(final String s) { try { return mapper.readValue(s, ComplianceActivity.class).toActivity(); } catch (final IOException | UncheckedIOException e) { logger.warn("Failed to parse compliance activity: " + s, e); return null; } }
1688262_0
public ShapedRecipe(RecipeBuilder builder) { super(builder.result, builder.plugin, builder.includeData); this.rows = builder.rows; this.ingredientsMap = builder.ingredientsMap; }
1688262_1
public ShapelessRecipe(RecipeBuilder builder) { super(builder.result, builder.plugin, builder.includeData); this.ingredients = builder.ingredients; }
1688262_2
public RecipeBuilder clone(Recipe recipe) { plugin = recipe.getPlugin(); result = recipe.getResult(); ingredients = recipe.getIngredients(); if (recipe instanceof ShapedRecipe) { ShapedRecipe shaped = (ShapedRecipe) recipe; this.ingredientsMap = shaped.getIngredientsMap(); rows.addAll(shaped.getRows()); } el...
1688262_3
@Override public int size() { return getContents().length; }
1688262_4
public boolean contains(Material material, int amount) { return getAmount(material) >= amount; }
1688262_5
public void add(int firstSlot, int lastSlot, ItemStack item) { //First pass try to add to existing stacks, second pass, add to empty slots final boolean reversed = lastSlot < firstSlot; final int incr = reversed ? -1 : 1; for (int pass = 0; pass < 2; pass++) { for (int index = firstSlot; reversed ? (index >= last...
1688262_6
@Override public boolean remove(Object o) { for (int i = 0; i < contents.length; i++) { ItemStack item = get(i); if (item == null) { continue; } if (item.equals(o) || item.getMaterial().equals(o)) { set(i, null); return true; } } return false; }
1688262_7
@Override public boolean addAll(Collection<? extends ItemStack> items) { Iterator<? extends ItemStack> i = items.iterator(); while (i.hasNext()) { ItemStack next = i.next(); if (next == null) { continue; } add(next); } return true; }
1688262_8
@Override public boolean removeAll(Collection<?> objects) { Iterator<?> iter = objects.iterator(); while (iter.hasNext()) { Object o = iter.next(); for (int i = 0; i < size(); i++) { ItemStack item = get(i); if (item == null) { continue; } if (o instanceof ItemStack && ((ItemStack) o).equalsIgnore...
1688262_9
@Override public boolean retainAll(Collection<?> objects) { for (ItemStack item : getContents()) { if (item == null) { continue; } if (!objects.contains(item)) { remove(item); } } return true; }
1691340_0
static IMenuService getSubMenuService(Map<String, IMenuService> menuMap) { int length = menuMap.size(); if (length == 0) return null; Iterator<IMenuService> it = menuMap.values().iterator(); IMenuService sub = null; while (it.hasNext()) { if (length == 1) return it.next(); IMenuService temp = it.next(); Clas...
1691340_1
public static String getMenusJson(String id, int level) { IMenuService menuService = getMenuService(); List<? extends IMenu> menus = null; if (menuService != null) { menus = menuService.getMenus(id, level); } else { menus = getAllModulesDefaultMenu(); } return convert(menus); }
1691340_2
public static ApplicationContext getApplicationContext() { return getAc(); }
1691340_3
public static Resource[] getStrutsConfigResources() { List<Resource> resourcesList = new ArrayList<Resource>(16); Enumeration<ModulePluginDriverInfo> dirverInfos = getDriverInfos(); SystemLogUtils.rootPrintln("Struts Config 配置文件Find Begin!"); while (dirverInfos.hasMoreElements()) { ModulePluginDriverInfo driverIn...
1691340_4
public static Resource[] getStrutsConfigResources() { List<Resource> resourcesList = new ArrayList<Resource>(16); Enumeration<ModulePluginDriverInfo> dirverInfos = getDriverInfos(); SystemLogUtils.rootPrintln("Struts Config 配置文件Find Begin!"); while (dirverInfos.hasMoreElements()) { ModulePluginDriverInfo driverIn...
1691340_5
public static Object invokeGetterMethod(Object obj, String propertyName) { String getterMethodName = "get" + StringUtils.capitalize(propertyName); return invokeMethod(obj, getterMethodName, new Class[]{}, new Object[]{}); }
1691340_6
public static Object getFieldValue(final Object obj, final String fieldName) { if (obj == null || StringUtil.isEmpty(fieldName)) { return null; } int index = fieldName.indexOf("."); if (index < 0) { Field field = getAccessibleField(obj, fieldName); if (field == null) { throw new IllegalArgumentException("C...
1691340_7
public static void setFieldValue(final Object obj, final String fieldName, final Object value) { if (obj == null) { throw new IllegalArgumentException("[" + obj + "]"); } int index = fieldName.indexOf("."); if (index < 0) { Field field = getAccessibleField(obj, fieldName); if (field == null) { throw new Il...
1691340_8
public static Field getAccessibleField(final Object obj, final String fieldName) { if (obj == null || StringUtil.isEmpty(fieldName)) { return null; } int index = fieldName.indexOf("."); if (index < 0) { return getAccessibleField0(obj, fieldName); } else { return getAccessibleField(getFieldValue(obj, fieldNam...
1691340_9
public static Method getAccessibleMethod(final Object obj, final String methodName, final Class<?>... parameterTypes) { if (obj == null) { return null; } for (Class<?> superClass = obj.getClass(); superClass != Object.class; superClass = superClass.getSuperclass()) { try { Method method = superClass.getDeclar...
1707059_0
protected static List<PathSegment> extractPathComponents(String path) { List<PathSegment> components = new ArrayList<PathSegment>(); if (path != null) { int inBrace = 0; boolean definingRegexp = false; StringBuilder name = new StringBuilder(); StringBuilder regexp = new StringBuilder(); for (int...
1707059_1
protected static List<PathSegment> extractPathComponents(String path) { List<PathSegment> components = new ArrayList<PathSegment>(); if (path != null) { StringBuilder value = new StringBuilder(); if (!path.startsWith("/")) { value.append("/");//first path segment should always start with "/" } ...
1707059_2
static List<String> getGroupsOnField(String groupsAsString) { List<String> classes = new ArrayList<>(); final String validationGroupsPrefix = "groups()={"; int indexOfGroups = groupsAsString.indexOf(validationGroupsPrefix); if (indexOfGroups == -1) { return Collections.emptyList(); } Str...
1707059_3
static List<String> getGroupsOnField(String groupsAsString) { List<String> classes = new ArrayList<>(); final String validationGroupsPrefix = "groups()={"; int indexOfGroups = groupsAsString.indexOf(validationGroupsPrefix); if (indexOfGroups == -1) { return Collections.emptyList(); } Str...
1707059_4
static List<String> getGroupsOnField(String groupsAsString) { List<String> classes = new ArrayList<>(); final String validationGroupsPrefix = "groups()={"; int indexOfGroups = groupsAsString.indexOf(validationGroupsPrefix); if (indexOfGroups == -1) { return Collections.emptyList(); } Str...
1707059_5
static List<String> getGroupsOnField(String groupsAsString) { List<String> classes = new ArrayList<>(); final String validationGroupsPrefix = "groups()={"; int indexOfGroups = groupsAsString.indexOf(validationGroupsPrefix); if (indexOfGroups == -1) { return Collections.emptyList(); } Str...
1707059_6
public static boolean hasMatchingValidationGroup(String targetGroups, AnnotationMirror annotationMirror) { // get validationGroups from Enunciate config file, this holds the active validation groups (if any) in attribute // "beanValidationGroups" of jackson module: // e.g. <jackson disabled="false" beanVali...
1707059_7
public static boolean hasMatchingValidationGroup(String targetGroups, AnnotationMirror annotationMirror) { // get validationGroups from Enunciate config file, this holds the active validation groups (if any) in attribute // "beanValidationGroups" of jackson module: // e.g. <jackson disabled="false" beanVali...
1707059_8
public static boolean hasMatchingValidationGroup(String targetGroups, AnnotationMirror annotationMirror) { // get validationGroups from Enunciate config file, this holds the active validation groups (if any) in attribute // "beanValidationGroups" of jackson module: // e.g. <jackson disabled="false" beanVali...
1707059_9
public static boolean hasMatchingValidationGroup(String targetGroups, AnnotationMirror annotationMirror) { // get validationGroups from Enunciate config file, this holds the active validation groups (if any) in attribute // "beanValidationGroups" of jackson module: // e.g. <jackson disabled="false" beanVali...
1710792_0
@Override public String toString() { final Hex hex = new Hex(); final byte[] bytes = new byte[getLength()]; System.arraycopy(getBytes(), 0, bytes, 0, bytes.length); return new String(hex.encode(bytes)); }
1710792_1
static BoxerUnboxer<?,? extends Writable> createOutputType(String type) { if ("text".equals(type)) { return new TextBoxerUnboxer(); } else if ("long".equals(type)) { return new LongBoxerUnboxer(); } else if ("double".equals(type)) { return new DoubleBoxerUnboxer(); } else if ("json".equals(typ...
1710792_2
static BoxerUnboxer<?,? extends Writable> createOutputType(String type) { if ("text".equals(type)) { return new TextBoxerUnboxer(); } else if ("long".equals(type)) { return new LongBoxerUnboxer(); } else if ("double".equals(type)) { return new DoubleBoxerUnboxer(); } else if ("json".equals(typ...
1710792_3
static BoxerUnboxer<?,? extends Writable> createOutputType(String type) { if ("text".equals(type)) { return new TextBoxerUnboxer(); } else if ("long".equals(type)) { return new LongBoxerUnboxer(); } else if ("double".equals(type)) { return new DoubleBoxerUnboxer(); } else if ("json".equals(typ...
1710792_4
static BoxerUnboxer<?,? extends Writable> createOutputType(String type) { if ("text".equals(type)) { return new TextBoxerUnboxer(); } else if ("long".equals(type)) { return new LongBoxerUnboxer(); } else if ("double".equals(type)) { return new DoubleBoxerUnboxer(); } else if ("json".equals(typ...
1710792_5
static BoxerUnboxer<?,? extends Writable> createOutputType(String type) { if ("text".equals(type)) { return new TextBoxerUnboxer(); } else if ("long".equals(type)) { return new LongBoxerUnboxer(); } else if ("double".equals(type)) { return new DoubleBoxerUnboxer(); } else if ("json".equals(typ...
1710792_6
static BoxerUnboxer<?,? extends Writable> createOutputType(String type) { if ("text".equals(type)) { return new TextBoxerUnboxer(); } else if ("long".equals(type)) { return new LongBoxerUnboxer(); } else if ("double".equals(type)) { return new DoubleBoxerUnboxer(); } else if ("json".equals(typ...
1711412_0
public void setCompiler(Compiler compiler) { this.compiler = compiler; }
1711412_1
public void setCompiler(Compiler compiler) { this.compiler = compiler; }
1711467_0
protected void validate(List<TableInfo> tableInfos) { db = mongo.getDB(databaseName); if (db == null) { logger.error("Database " + databaseName + "does not exist"); throw new SchemaGenerationException("database " + databaseName + "does not exist", "mongoDb", databaseName); } else ...
1711467_1
protected void update(List<TableInfo> tableInfos) { for (TableInfo tableInfo : tableInfos) { DBObject options = setCollectionProperties(tableInfo); DB db = mongo.getDB(databaseName); DBCollection collection = null; if (tableInfo.getLobColumnInfo().isEmpty()) { ...
1711467_2
protected void create(List<TableInfo> tableInfos) { for (TableInfo tableInfo : tableInfos) { DBObject options = setCollectionProperties(tableInfo); DB db = mongo.getDB(databaseName); if (tableInfo.getLobColumnInfo().isEmpty()) { if (db.collectionExists(tableInfo.getTa...
1711467_3
public void dropSchema() { if (operation != null && operation.equalsIgnoreCase("create-drop")) { for (TableInfo tableInfo : tableInfos) { if (tableInfo.getLobColumnInfo().isEmpty()) { coll = db.getCollection(tableInfo.getTableName()); coll....
1711467_4
public Properties getConnectionProperties() { return esmd != null ? esmd.getConnectionProperties() : null; }