id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
112,700
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/utils/ReflectionUtils.java
ReflectionUtils.isPropertyType
public static boolean isPropertyType(final Class type) { return type != null && (isPrimitiveLike(type) || type == DBRef.class || type == Pattern.class || type == CodeWScope.class || type == ObjectId.class || type == Key.class || type == DBObject.cl...
java
public static boolean isPropertyType(final Class type) { return type != null && (isPrimitiveLike(type) || type == DBRef.class || type == Pattern.class || type == CodeWScope.class || type == ObjectId.class || type == Key.class || type == DBObject.cl...
[ "public", "static", "boolean", "isPropertyType", "(", "final", "Class", "type", ")", "{", "return", "type", "!=", "null", "&&", "(", "isPrimitiveLike", "(", "type", ")", "||", "type", "==", "DBRef", ".", "class", "||", "type", "==", "Pattern", ".", "clas...
Checks if the Class given is a property type @param type the Class to examine @return true if the Class's type is considered a property type
[ "Checks", "if", "the", "Class", "given", "is", "a", "property", "type" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/utils/ReflectionUtils.java#L382-L387
112,701
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/utils/ReflectionUtils.java
ReflectionUtils.isPrimitiveLike
public static boolean isPrimitiveLike(final Class type) { return type != null && (type == String.class || type == char.class || type == Character.class || type == short.class || type == Short.class || type == Integer.class || type == int.class || t...
java
public static boolean isPrimitiveLike(final Class type) { return type != null && (type == String.class || type == char.class || type == Character.class || type == short.class || type == Short.class || type == Integer.class || type == int.class || t...
[ "public", "static", "boolean", "isPrimitiveLike", "(", "final", "Class", "type", ")", "{", "return", "type", "!=", "null", "&&", "(", "type", "==", "String", ".", "class", "||", "type", "==", "char", ".", "class", "||", "type", "==", "Character", ".", ...
Checks if the Class given is a primitive type. This includes the Java primitive types and their wrapper types. @param type the Class to examine @return true if the Class's type is considered a primitive type
[ "Checks", "if", "the", "Class", "given", "is", "a", "primitive", "type", ".", "This", "includes", "the", "Java", "primitive", "types", "and", "their", "wrapper", "types", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/utils/ReflectionUtils.java#L395-L404
112,702
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/utils/ReflectionUtils.java
ReflectionUtils.getAnnotation
public static <T> T getAnnotation(final Class c, final Class<T> annotation) { final List<T> found = getAnnotations(c, annotation); if (found != null && !found.isEmpty()) { return found.get(0); } else { return null; } }
java
public static <T> T getAnnotation(final Class c, final Class<T> annotation) { final List<T> found = getAnnotations(c, annotation); if (found != null && !found.isEmpty()) { return found.get(0); } else { return null; } }
[ "public", "static", "<", "T", ">", "T", "getAnnotation", "(", "final", "Class", "c", ",", "final", "Class", "<", "T", ">", "annotation", ")", "{", "final", "List", "<", "T", ">", "found", "=", "getAnnotations", "(", "c", ",", "annotation", ")", ";", ...
Returns an annotation on a Class if present @param c the class to examine @param annotation the annotation to find @param <T> the type of the annotation @return the annotation. may be null.
[ "Returns", "an", "annotation", "on", "a", "Class", "if", "present" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/utils/ReflectionUtils.java#L424-L431
112,703
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/utils/ReflectionUtils.java
ReflectionUtils.getFromJarFile
public static Set<Class<?>> getFromJarFile(final ClassLoader loader, final String jar, final String packageName, final boolean mapSubPackages) throws IOException, ClassNotFoundException { ...
java
public static Set<Class<?>> getFromJarFile(final ClassLoader loader, final String jar, final String packageName, final boolean mapSubPackages) throws IOException, ClassNotFoundException { ...
[ "public", "static", "Set", "<", "Class", "<", "?", ">", ">", "getFromJarFile", "(", "final", "ClassLoader", "loader", ",", "final", "String", "jar", ",", "final", "String", "packageName", ",", "final", "boolean", "mapSubPackages", ")", "throws", "IOException",...
Returns the classes in a package found in a jar @param loader the ClassLoader to use @param jar the jar to scan @param packageName the package to scan @param mapSubPackages whether to map the sub-packages while scanning @return the list of classes @throws IOException thrown if an error...
[ "Returns", "the", "classes", "in", "a", "package", "found", "in", "a", "jar" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/utils/ReflectionUtils.java#L587-L611
112,704
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/utils/ReflectionUtils.java
ReflectionUtils.getFromDirectory
public static Set<Class<?>> getFromDirectory(final ClassLoader loader, final File directory, final String packageName, final boolean mapSubPackages) throws ClassNotFoundException { final Set<Class<?>> classes = new HashSet<Class<?>>(); if (directory.exist...
java
public static Set<Class<?>> getFromDirectory(final ClassLoader loader, final File directory, final String packageName, final boolean mapSubPackages) throws ClassNotFoundException { final Set<Class<?>> classes = new HashSet<Class<?>>(); if (directory.exist...
[ "public", "static", "Set", "<", "Class", "<", "?", ">", ">", "getFromDirectory", "(", "final", "ClassLoader", "loader", ",", "final", "File", "directory", ",", "final", "String", "packageName", ",", "final", "boolean", "mapSubPackages", ")", "throws", "ClassNo...
Returns the classes in a package found in a directory @param loader the ClassLoader to use @param directory the directory to scan @param packageName the package to scan @param mapSubPackages whether to map the sub-packages while scanning @return the list of classes @throws ClassNotFoundException thrown...
[ "Returns", "the", "classes", "in", "a", "package", "found", "in", "a", "directory" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/utils/ReflectionUtils.java#L623-L636
112,705
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/utils/ReflectionUtils.java
ReflectionUtils.iterToList
public static <T> List<T> iterToList(final Iterable<T> it) { if (it instanceof List) { return (List<T>) it; } if (it == null) { return null; } final List<T> ar = new ArrayList<T>(); for (final T o : it) { ar.add(o); } ...
java
public static <T> List<T> iterToList(final Iterable<T> it) { if (it instanceof List) { return (List<T>) it; } if (it == null) { return null; } final List<T> ar = new ArrayList<T>(); for (final T o : it) { ar.add(o); } ...
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "iterToList", "(", "final", "Iterable", "<", "T", ">", "it", ")", "{", "if", "(", "it", "instanceof", "List", ")", "{", "return", "(", "List", "<", "T", ">", ")", "it", ";", "}", "if", ...
Converts an Iterable to a List @param it the Iterable @param <T> the types of the elements in the Iterable @return the List
[ "Converts", "an", "Iterable", "to", "a", "List" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/utils/ReflectionUtils.java#L676-L690
112,706
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/utils/ReflectionUtils.java
ReflectionUtils.convertToArray
public static Object convertToArray(final Class type, final List<?> values) { final Object exampleArray = Array.newInstance(type, values.size()); try { return values.toArray((Object[]) exampleArray); } catch (ClassCastException e) { for (int i = 0; i < values.size(); i++)...
java
public static Object convertToArray(final Class type, final List<?> values) { final Object exampleArray = Array.newInstance(type, values.size()); try { return values.toArray((Object[]) exampleArray); } catch (ClassCastException e) { for (int i = 0; i < values.size(); i++)...
[ "public", "static", "Object", "convertToArray", "(", "final", "Class", "type", ",", "final", "List", "<", "?", ">", "values", ")", "{", "final", "Object", "exampleArray", "=", "Array", ".", "newInstance", "(", "type", ",", "values", ".", "size", "(", ")"...
Converts a List to an array @param type the Class type of the elements of the List @param values the List to convert @return the array
[ "Converts", "a", "List", "to", "an", "array" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/utils/ReflectionUtils.java#L699-L709
112,707
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/utils/ReflectionUtils.java
ReflectionUtils.getTypeArgument
public static <T> Class<?> getTypeArgument(final Class<? extends T> clazz, final TypeVariable<? extends GenericDeclaration> tv) { final Map<Type, Type> resolvedTypes = new HashMap<Type, Type>(); Type type = clazz; // start walking up the inheritance hierarchy until we hit the end while (...
java
public static <T> Class<?> getTypeArgument(final Class<? extends T> clazz, final TypeVariable<? extends GenericDeclaration> tv) { final Map<Type, Type> resolvedTypes = new HashMap<Type, Type>(); Type type = clazz; // start walking up the inheritance hierarchy until we hit the end while (...
[ "public", "static", "<", "T", ">", "Class", "<", "?", ">", "getTypeArgument", "(", "final", "Class", "<", "?", "extends", "T", ">", "clazz", ",", "final", "TypeVariable", "<", "?", "extends", "GenericDeclaration", ">", "tv", ")", "{", "final", "Map", "...
Returns the type argument @param clazz the Class to examine @param tv the TypeVariable to look for @param <T> the type of the Class @return the Class type
[ "Returns", "the", "type", "argument" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/utils/ReflectionUtils.java#L802-L844
112,708
MorphiaOrg/morphia
morphia/src/main/java/relocated/morphia/org/apache/commons/collections/DefaultMapEntry.java
DefaultMapEntry.setValue
public Object setValue(final Object value) { final Object answer = this.value; this.value = value; return answer; }
java
public Object setValue(final Object value) { final Object answer = this.value; this.value = value; return answer; }
[ "public", "Object", "setValue", "(", "final", "Object", "value", ")", "{", "final", "Object", "answer", "=", "this", ".", "value", ";", "this", ".", "value", "=", "value", ";", "return", "answer", ";", "}" ]
Note that this method only sets the local reference inside this object and does not modify the original Map. @param value the new value @return the old value of the value
[ "Note", "that", "this", "method", "only", "sets", "the", "local", "reference", "inside", "this", "object", "and", "does", "not", "modify", "the", "original", "Map", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/relocated/morphia/org/apache/commons/collections/DefaultMapEntry.java#L82-L86
112,709
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/experimental/MorphiaReference.java
MorphiaReference.wrap
@SuppressWarnings("unchecked") public static <V> MorphiaReference<V> wrap(final V value) { if (value instanceof List) { return (MorphiaReference<V>) new ListReference<V>((List<V>) value); } else if (value instanceof Set) { return (MorphiaReference<V>) new SetReference<V>((Set...
java
@SuppressWarnings("unchecked") public static <V> MorphiaReference<V> wrap(final V value) { if (value instanceof List) { return (MorphiaReference<V>) new ListReference<V>((List<V>) value); } else if (value instanceof Set) { return (MorphiaReference<V>) new SetReference<V>((Set...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "V", ">", "MorphiaReference", "<", "V", ">", "wrap", "(", "final", "V", "value", ")", "{", "if", "(", "value", "instanceof", "List", ")", "{", "return", "(", "MorphiaReference", ...
Wraps an value in a MorphiaReference to storing on an entity @param value the value wrap @param <V> the type of the value @return the MorphiaReference wrapper
[ "Wraps", "an", "value", "in", "a", "MorphiaReference", "to", "storing", "on", "an", "entity" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/experimental/MorphiaReference.java#L84-L95
112,710
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/query/PushOptions.java
PushOptions.sort
public PushOptions sort(final String field, final int direction) { if (sort != null) { throw new IllegalStateException("sortDocument can not be set if sort already is"); } if (sortDocument == null) { sortDocument = new BasicDBObject(); } sortDocument.put(f...
java
public PushOptions sort(final String field, final int direction) { if (sort != null) { throw new IllegalStateException("sortDocument can not be set if sort already is"); } if (sortDocument == null) { sortDocument = new BasicDBObject(); } sortDocument.put(f...
[ "public", "PushOptions", "sort", "(", "final", "String", "field", ",", "final", "int", "direction", ")", "{", "if", "(", "sort", "!=", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"sortDocument can not be set if sort already is\"", ")", ";", ...
Sets the sort value for the update @param field the field to sort by @param direction the direction of the sort @return this
[ "Sets", "the", "sort", "value", "for", "the", "update" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/query/PushOptions.java#L80-L89
112,711
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/aggregation/AggregationPipelineImpl.java
AggregationPipelineImpl.toDBObject
private DBObject toDBObject(final Projection projection) { String target; if (firstStage) { MappedField field = mapper.getMappedClass(source).getMappedField(projection.getTarget()); target = field != null ? field.getNameToStore() : projection.getTarget(); } else { ...
java
private DBObject toDBObject(final Projection projection) { String target; if (firstStage) { MappedField field = mapper.getMappedClass(source).getMappedField(projection.getTarget()); target = field != null ? field.getNameToStore() : projection.getTarget(); } else { ...
[ "private", "DBObject", "toDBObject", "(", "final", "Projection", "projection", ")", "{", "String", "target", ";", "if", "(", "firstStage", ")", "{", "MappedField", "field", "=", "mapper", ".", "getMappedClass", "(", "source", ")", ".", "getMappedField", "(", ...
Converts a Projection to a DBObject for use by the Java driver. @param projection the project to apply @return the DBObject
[ "Converts", "a", "Projection", "to", "a", "DBObject", "for", "use", "by", "the", "Java", "driver", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/aggregation/AggregationPipelineImpl.java#L289-L328
112,712
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/internal/MorphiaUtils.java
MorphiaUtils.join
public static String join(final List<String> strings, final char delimiter) { StringBuilder builder = new StringBuilder(); for (String element : strings) { if (builder.length() != 0) { builder.append(delimiter); } builder.append(element); } ...
java
public static String join(final List<String> strings, final char delimiter) { StringBuilder builder = new StringBuilder(); for (String element : strings) { if (builder.length() != 0) { builder.append(delimiter); } builder.append(element); } ...
[ "public", "static", "String", "join", "(", "final", "List", "<", "String", ">", "strings", ",", "final", "char", "delimiter", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "String", "element", ":", "strings",...
Joins strings with the given delimiter @param strings the strings to join @param delimiter the delimiter @return the joined string
[ "Joins", "strings", "with", "the", "given", "delimiter" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/internal/MorphiaUtils.java#L38-L47
112,713
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/query/validation/TypeValidator.java
TypeValidator.apply
public boolean apply(final Class<?> type, final Object value, final List<ValidationFailure> validationFailures) { if (appliesTo(type)) { validate(type, value, validationFailures); return true; } return false; }
java
public boolean apply(final Class<?> type, final Object value, final List<ValidationFailure> validationFailures) { if (appliesTo(type)) { validate(type, value, validationFailures); return true; } return false; }
[ "public", "boolean", "apply", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "Object", "value", ",", "final", "List", "<", "ValidationFailure", ">", "validationFailures", ")", "{", "if", "(", "appliesTo", "(", "type", ")", ")", "{", "validat...
Apply validation for the given field. If the field is not of a type in the list returned by getTypeClasses, the validation is not applied and this method returns false. If the type is in the list, then the validate method is called to see if the value is of a type that can be applied to the given field type. Errors ...
[ "Apply", "validation", "for", "the", "given", "field", ".", "If", "the", "field", "is", "not", "of", "a", "type", "in", "the", "list", "returned", "by", "getTypeClasses", "the", "validation", "is", "not", "applied", "and", "this", "method", "returns", "fal...
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/query/validation/TypeValidator.java#L20-L28
112,714
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/Mapper.java
Mapper.addMappedClass
public MappedClass addMappedClass(final Class c) { MappedClass mappedClass = mappedClasses.get(c.getName()); if (mappedClass == null) { mappedClass = new MappedClass(c, this); return addMappedClass(mappedClass, true); } return mappedClass; }
java
public MappedClass addMappedClass(final Class c) { MappedClass mappedClass = mappedClasses.get(c.getName()); if (mappedClass == null) { mappedClass = new MappedClass(c, this); return addMappedClass(mappedClass, true); } return mappedClass; }
[ "public", "MappedClass", "addMappedClass", "(", "final", "Class", "c", ")", "{", "MappedClass", "mappedClass", "=", "mappedClasses", ".", "get", "(", "c", ".", "getName", "(", ")", ")", ";", "if", "(", "mappedClass", "==", "null", ")", "{", "mappedClass", ...
Creates a MappedClass and validates it. @param c the Class to map @return the MappedClass for the given Class
[ "Creates", "a", "MappedClass", "and", "validates", "it", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/Mapper.java#L168-L176
112,715
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/Mapper.java
Mapper.getSubTypes
public List<MappedClass> getSubTypes(final MappedClass mc) { List<MappedClass> subtypes = new ArrayList<MappedClass>(); for (MappedClass mappedClass : getMappedClasses()) { if (mappedClass.isSubType(mc)) { subtypes.add(mappedClass); } } return sub...
java
public List<MappedClass> getSubTypes(final MappedClass mc) { List<MappedClass> subtypes = new ArrayList<MappedClass>(); for (MappedClass mappedClass : getMappedClasses()) { if (mappedClass.isSubType(mc)) { subtypes.add(mappedClass); } } return sub...
[ "public", "List", "<", "MappedClass", ">", "getSubTypes", "(", "final", "MappedClass", "mc", ")", "{", "List", "<", "MappedClass", ">", "subtypes", "=", "new", "ArrayList", "<", "MappedClass", ">", "(", ")", ";", "for", "(", "MappedClass", "mappedClass", "...
Finds any subtypes for the given MappedClass. @param mc the parent type @return the list of subtypes @since 1.3
[ "Finds", "any", "subtypes", "for", "the", "given", "MappedClass", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/Mapper.java#L216-L225
112,716
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/Mapper.java
Mapper.getClassFromCollection
@Deprecated public Class<?> getClassFromCollection(final String collection) { final Set<MappedClass> mcs = mappedClassesByCollection.get(collection); if (mcs == null || mcs.isEmpty()) { throw new MappingException(format("The collection '%s' is not mapped to a java class.", collection)); ...
java
@Deprecated public Class<?> getClassFromCollection(final String collection) { final Set<MappedClass> mcs = mappedClassesByCollection.get(collection); if (mcs == null || mcs.isEmpty()) { throw new MappingException(format("The collection '%s' is not mapped to a java class.", collection)); ...
[ "@", "Deprecated", "public", "Class", "<", "?", ">", "getClassFromCollection", "(", "final", "String", "collection", ")", "{", "final", "Set", "<", "MappedClass", ">", "mcs", "=", "mappedClassesByCollection", ".", "get", "(", "collection", ")", ";", "if", "(...
Looks up the class mapped to a named collection. @param collection the collection name @return the Class mapped to this collection name @morphia.internal @deprecated no replacement is planned
[ "Looks", "up", "the", "class", "mapped", "to", "a", "named", "collection", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/Mapper.java#L325-L337
112,717
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/Mapper.java
Mapper.getCollectionName
@Deprecated public String getCollectionName(final Object object) { if (object == null) { throw new IllegalArgumentException(); } final MappedClass mc = getMappedClass(object); return mc.getCollectionName(); }
java
@Deprecated public String getCollectionName(final Object object) { if (object == null) { throw new IllegalArgumentException(); } final MappedClass mc = getMappedClass(object); return mc.getCollectionName(); }
[ "@", "Deprecated", "public", "String", "getCollectionName", "(", "final", "Object", "object", ")", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "final", "MappedClass", "mc", "=", "getMapped...
Gets the mapped collection for an object instance or Class reference. @param object the object to process @return the collection name @morphia.internal @deprecated no replacement is planned
[ "Gets", "the", "mapped", "collection", "for", "an", "object", "instance", "or", "Class", "reference", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/Mapper.java#L347-L355
112,718
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/Mapper.java
Mapper.getId
public Object getId(final Object entity) { Object unwrapped = entity; if (unwrapped == null) { return null; } unwrapped = ProxyHelper.unwrap(unwrapped); try { final MappedClass mappedClass = getMappedClass(unwrapped.getClass()); if (mappedClass...
java
public Object getId(final Object entity) { Object unwrapped = entity; if (unwrapped == null) { return null; } unwrapped = ProxyHelper.unwrap(unwrapped); try { final MappedClass mappedClass = getMappedClass(unwrapped.getClass()); if (mappedClass...
[ "public", "Object", "getId", "(", "final", "Object", "entity", ")", "{", "Object", "unwrapped", "=", "entity", ";", "if", "(", "unwrapped", "==", "null", ")", "{", "return", "null", ";", "}", "unwrapped", "=", "ProxyHelper", ".", "unwrap", "(", "unwrappe...
Gets the ID value for an entity @param entity the entity to process @return the ID value
[ "Gets", "the", "ID", "value", "for", "an", "entity" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/Mapper.java#L370-L388
112,719
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/Mapper.java
Mapper.getKey
public <T> Key<T> getKey(final T entity) { T unwrapped = entity; if (unwrapped instanceof ProxiedEntityReference) { final ProxiedEntityReference proxy = (ProxiedEntityReference) unwrapped; return (Key<T>) proxy.__getKey(); } unwrapped = ProxyHelper.unwrap(unwrapp...
java
public <T> Key<T> getKey(final T entity) { T unwrapped = entity; if (unwrapped instanceof ProxiedEntityReference) { final ProxiedEntityReference proxy = (ProxiedEntityReference) unwrapped; return (Key<T>) proxy.__getKey(); } unwrapped = ProxyHelper.unwrap(unwrapp...
[ "public", "<", "T", ">", "Key", "<", "T", ">", "getKey", "(", "final", "T", "entity", ")", "{", "T", "unwrapped", "=", "entity", ";", "if", "(", "unwrapped", "instanceof", "ProxiedEntityReference", ")", "{", "final", "ProxiedEntityReference", "proxy", "=",...
Gets the Key for an entity @param entity the entity to process @param <T> the type of the entity @return the Key
[ "Gets", "the", "Key", "for", "an", "entity" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/Mapper.java#L415-L430
112,720
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/Mapper.java
Mapper.keyToDBRef
public DBRef keyToDBRef(final Key key) { if (key == null) { return null; } if (key.getType() == null && key.getCollection() == null) { throw new IllegalStateException("How can it be missing both?"); } if (key.getCollection() == null) { key.setC...
java
public DBRef keyToDBRef(final Key key) { if (key == null) { return null; } if (key.getType() == null && key.getCollection() == null) { throw new IllegalStateException("How can it be missing both?"); } if (key.getCollection() == null) { key.setC...
[ "public", "DBRef", "keyToDBRef", "(", "final", "Key", "key", ")", "{", "if", "(", "key", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "key", ".", "getType", "(", ")", "==", "null", "&&", "key", ".", "getCollection", "(", ")", "=...
Converts a Key to a DBRef @param key the Key to convert @return the DBRef
[ "Converts", "a", "Key", "to", "a", "DBRef" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/Mapper.java#L562-L578
112,721
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/Mapper.java
Mapper.manualRefToKey
public <T> Key<T> manualRefToKey(final Class<T> type, final Object id) { return id == null ? null : new Key<T>(type, getCollectionName(type), id); }
java
public <T> Key<T> manualRefToKey(final Class<T> type, final Object id) { return id == null ? null : new Key<T>(type, getCollectionName(type), id); }
[ "public", "<", "T", ">", "Key", "<", "T", ">", "manualRefToKey", "(", "final", "Class", "<", "T", ">", "type", ",", "final", "Object", "id", ")", "{", "return", "id", "==", "null", "?", "null", ":", "new", "Key", "<", "T", ">", "(", "type", ","...
Creates a Key for a type and an ID value @param type the Class of the entity @param id the ID value @param <T> the type of the entity @return the Key
[ "Creates", "a", "Key", "for", "a", "type", "and", "an", "ID", "value" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/Mapper.java#L588-L590
112,722
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/Mapper.java
Mapper.refToKey
public <T> Key<T> refToKey(final DBRef ref) { return ref == null ? null : new Key<T>((Class<? extends T>) getClassFromCollection(ref.getCollectionName()), ref.getCollectionName(), ref.getId()); }
java
public <T> Key<T> refToKey(final DBRef ref) { return ref == null ? null : new Key<T>((Class<? extends T>) getClassFromCollection(ref.getCollectionName()), ref.getCollectionName(), ref.getId()); }
[ "public", "<", "T", ">", "Key", "<", "T", ">", "refToKey", "(", "final", "DBRef", "ref", ")", "{", "return", "ref", "==", "null", "?", "null", ":", "new", "Key", "<", "T", ">", "(", "(", "Class", "<", "?", "extends", "T", ">", ")", "getClassFro...
Converts a DBRef to a Key @param ref the DBRef to convert @param <T> the type of the referenced entity @return the Key
[ "Converts", "a", "DBRef", "to", "a", "Key" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/Mapper.java#L599-L602
112,723
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/Mapper.java
Mapper.updateCollection
public String updateCollection(final Key key) { if (key.getCollection() == null && key.getType() == null) { throw new IllegalStateException("Key is invalid! " + toString()); } else if (key.getCollection() == null) { key.setCollection(getMappedClass(key.getType()).getCollectionNam...
java
public String updateCollection(final Key key) { if (key.getCollection() == null && key.getType() == null) { throw new IllegalStateException("Key is invalid! " + toString()); } else if (key.getCollection() == null) { key.setCollection(getMappedClass(key.getType()).getCollectionNam...
[ "public", "String", "updateCollection", "(", "final", "Key", "key", ")", "{", "if", "(", "key", ".", "getCollection", "(", ")", "==", "null", "&&", "key", ".", "getType", "(", ")", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "...
Updates the collection value on a Key with the mapped value on the Key's type Class @param key the Key to update @return the collection name on the Key
[ "Updates", "the", "collection", "value", "on", "a", "Key", "with", "the", "mapped", "value", "on", "the", "Key", "s", "type", "Class" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/Mapper.java#L739-L747
112,724
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/Mapper.java
Mapper.addMappedClass
private MappedClass addMappedClass(final MappedClass mc, final boolean validate) { addConverters(mc); if (validate && !mc.isInterface()) { mc.validate(this); } mappedClasses.put(mc.getClazz().getName(), mc); Set<MappedClass> mcs = mappedClassesByCollection.get(mc.g...
java
private MappedClass addMappedClass(final MappedClass mc, final boolean validate) { addConverters(mc); if (validate && !mc.isInterface()) { mc.validate(this); } mappedClasses.put(mc.getClazz().getName(), mc); Set<MappedClass> mcs = mappedClassesByCollection.get(mc.g...
[ "private", "MappedClass", "addMappedClass", "(", "final", "MappedClass", "mc", ",", "final", "boolean", "validate", ")", "{", "addConverters", "(", "mc", ")", ";", "if", "(", "validate", "&&", "!", "mc", ".", "isInterface", "(", ")", ")", "{", "mc", ".",...
Add MappedClass to internal cache, possibly validating first.
[ "Add", "MappedClass", "to", "internal", "cache", "possibly", "validating", "first", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/Mapper.java#L813-L834
112,725
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/cache/EntityCacheStatistics.java
EntityCacheStatistics.copy
public EntityCacheStatistics copy() { final EntityCacheStatistics copy = new EntityCacheStatistics(); copy.entities = entities; copy.hits = hits; copy.misses = misses; return copy; }
java
public EntityCacheStatistics copy() { final EntityCacheStatistics copy = new EntityCacheStatistics(); copy.entities = entities; copy.hits = hits; copy.misses = misses; return copy; }
[ "public", "EntityCacheStatistics", "copy", "(", ")", "{", "final", "EntityCacheStatistics", "copy", "=", "new", "EntityCacheStatistics", "(", ")", ";", "copy", ".", "entities", "=", "entities", ";", "copy", ".", "hits", "=", "hits", ";", "copy", ".", "misses...
Copies the statistics @return the copy
[ "Copies", "the", "statistics" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/cache/EntityCacheStatistics.java#L17-L23
112,726
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/query/BucketAutoOptions.java
BucketAutoOptions.toDBObject
public DBObject toDBObject() { DBObject dbObject = new BasicDBObject(); if (granularity != null) { dbObject.put("granularity", granularity.getGranulality()); } DBObject output = new BasicDBObject(); for (Map.Entry<String, Accumulator> entry : accumulators.entrySet())...
java
public DBObject toDBObject() { DBObject dbObject = new BasicDBObject(); if (granularity != null) { dbObject.put("granularity", granularity.getGranulality()); } DBObject output = new BasicDBObject(); for (Map.Entry<String, Accumulator> entry : accumulators.entrySet())...
[ "public", "DBObject", "toDBObject", "(", ")", "{", "DBObject", "dbObject", "=", "new", "BasicDBObject", "(", ")", ";", "if", "(", "granularity", "!=", "null", ")", "{", "dbObject", ".", "put", "(", "\"granularity\"", ",", "granularity", ".", "getGranulality"...
Converts a BucketAutoOptions to a DBObject for use by the Java driver. @return the DBObject
[ "Converts", "a", "BucketAutoOptions", "to", "a", "DBObject", "for", "use", "by", "the", "Java", "driver", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/query/BucketAutoOptions.java#L26-L41
112,727
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/query/Shape.java
Shape.toDBObject
public DBObject toDBObject() { final BasicDBList list = new BasicDBList(); for (final Point point : points) { list.add(point.toDBObject()); } return new BasicDBObject(geometry, list); }
java
public DBObject toDBObject() { final BasicDBList list = new BasicDBList(); for (final Point point : points) { list.add(point.toDBObject()); } return new BasicDBObject(geometry, list); }
[ "public", "DBObject", "toDBObject", "(", ")", "{", "final", "BasicDBList", "list", "=", "new", "BasicDBList", "(", ")", ";", "for", "(", "final", "Point", "point", ":", "points", ")", "{", "list", ".", "add", "(", "point", ".", "toDBObject", "(", ")", ...
Creates a DBObject from this Shape @return the DBObject
[ "Creates", "a", "DBObject", "from", "this", "Shape" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/query/Shape.java#L90-L97
112,728
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/query/FindOptions.java
FindOptions.modifier
public FindOptions modifier(final String key, final Object value) { options.getModifiers().put(key, value); return this; }
java
public FindOptions modifier(final String key, final Object value) { options.getModifiers().put(key, value); return this; }
[ "public", "FindOptions", "modifier", "(", "final", "String", "key", ",", "final", "Object", "value", ")", "{", "options", ".", "getModifiers", "(", ")", ".", "put", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds a modifier to the find operation @param key the modifier name @param value the modifier value @return this
[ "Adds", "a", "modifier", "to", "the", "find", "operation" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/query/FindOptions.java#L198-L201
112,729
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/query/UpdateOpsImpl.java
UpdateOpsImpl.setOps
@SuppressWarnings("unchecked") public void setOps(final DBObject ops) { this.ops = (Map<String, Map<String, Object>>) ops; }
java
@SuppressWarnings("unchecked") public void setOps(final DBObject ops) { this.ops = (Map<String, Map<String, Object>>) ops; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "setOps", "(", "final", "DBObject", "ops", ")", "{", "this", ".", "ops", "=", "(", "Map", "<", "String", ",", "Map", "<", "String", ",", "Object", ">", ">", ")", "ops", ";", "}" ]
Sets the operations for this UpdateOpsImpl @param ops the operations
[ "Sets", "the", "operations", "for", "this", "UpdateOpsImpl" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/query/UpdateOpsImpl.java#L258-L261
112,730
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/lazy/proxy/ProxyHelper.java
ProxyHelper.unwrap
@SuppressWarnings("unchecked") public static <T> T unwrap(final T entity) { if (isProxy(entity)) { return (T) asProxy(entity).__unwrap(); } return entity; }
java
@SuppressWarnings("unchecked") public static <T> T unwrap(final T entity) { if (isProxy(entity)) { return (T) asProxy(entity).__unwrap(); } return entity; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "unwrap", "(", "final", "T", "entity", ")", "{", "if", "(", "isProxy", "(", "entity", ")", ")", "{", "return", "(", "T", ")", "asProxy", "(", "entity", ")", ...
If proxied, returns the unwrapped entity. @param entity the entity to check @param <T> the type of the entity @return the bare entity
[ "If", "proxied", "returns", "the", "unwrapped", "entity", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/lazy/proxy/ProxyHelper.java#L19-L25
112,731
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/lazy/proxy/ProxyHelper.java
ProxyHelper.getReferentClass
public static Class getReferentClass(final Object entity) { if (isProxy(entity)) { return asProxy(entity).__getReferenceObjClass(); } else { return entity != null ? entity.getClass() : null; } }
java
public static Class getReferentClass(final Object entity) { if (isProxy(entity)) { return asProxy(entity).__getReferenceObjClass(); } else { return entity != null ? entity.getClass() : null; } }
[ "public", "static", "Class", "getReferentClass", "(", "final", "Object", "entity", ")", "{", "if", "(", "isProxy", "(", "entity", ")", ")", "{", "return", "asProxy", "(", "entity", ")", ".", "__getReferenceObjClass", "(", ")", ";", "}", "else", "{", "ret...
Returns the class backing this entity @param entity the entity to check @return if proxied, the Class of the proxied type. the entity's Class otherwise
[ "Returns", "the", "class", "backing", "this", "entity" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/lazy/proxy/ProxyHelper.java#L57-L63
112,732
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/lazy/proxy/ProxyHelper.java
ProxyHelper.isFetched
public static boolean isFetched(final Object entity) { return entity == null || !isProxy(entity) || asProxy(entity).__isFetched(); }
java
public static boolean isFetched(final Object entity) { return entity == null || !isProxy(entity) || asProxy(entity).__isFetched(); }
[ "public", "static", "boolean", "isFetched", "(", "final", "Object", "entity", ")", "{", "return", "entity", "==", "null", "||", "!", "isProxy", "(", "entity", ")", "||", "asProxy", "(", "entity", ")", ".", "__isFetched", "(", ")", ";", "}" ]
Checks if the proxied entity has been fetched. @param entity the entity to check @return true if the proxy has been fetched.
[ "Checks", "if", "the", "proxied", "entity", "has", "been", "fetched", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/lazy/proxy/ProxyHelper.java#L81-L83
112,733
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/query/CountOptions.java
CountOptions.maxTime
public CountOptions maxTime(final long maxTime, final TimeUnit timeUnit) { notNull("timeUnit", timeUnit); options.maxTime(maxTime, timeUnit); return this; }
java
public CountOptions maxTime(final long maxTime, final TimeUnit timeUnit) { notNull("timeUnit", timeUnit); options.maxTime(maxTime, timeUnit); return this; }
[ "public", "CountOptions", "maxTime", "(", "final", "long", "maxTime", ",", "final", "TimeUnit", "timeUnit", ")", "{", "notNull", "(", "\"timeUnit\"", ",", "timeUnit", ")", ";", "options", ".", "maxTime", "(", "maxTime", ",", "timeUnit", ")", ";", "return", ...
Sets the maximum execution time on the server for this operation. @param maxTime the max time @param timeUnit the time unit, which may not be null @return this
[ "Sets", "the", "maximum", "execution", "time", "on", "the", "server", "for", "this", "operation", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/query/CountOptions.java#L164-L168
112,734
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/MappedClass.java
MappedClass.addAnnotation
public void addAnnotation(final Class<? extends Annotation> clazz, final Annotation ann) { if (ann == null || clazz == null) { return; } if (!foundAnnotations.containsKey(clazz)) { foundAnnotations.put(clazz, new ArrayList<Annotation>()); } foundAnnotati...
java
public void addAnnotation(final Class<? extends Annotation> clazz, final Annotation ann) { if (ann == null || clazz == null) { return; } if (!foundAnnotations.containsKey(clazz)) { foundAnnotations.put(clazz, new ArrayList<Annotation>()); } foundAnnotati...
[ "public", "void", "addAnnotation", "(", "final", "Class", "<", "?", "extends", "Annotation", ">", "clazz", ",", "final", "Annotation", "ann", ")", "{", "if", "(", "ann", "==", "null", "||", "clazz", "==", "null", ")", "{", "return", ";", "}", "if", "...
Adds the given Annotation to the internal list for the given Class. @param clazz the type to add @param ann the annotation to add
[ "Adds", "the", "given", "Annotation", "to", "the", "internal", "list", "for", "the", "given", "Class", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/MappedClass.java#L222-L232
112,735
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/MappedClass.java
MappedClass.callLifecycleMethods
@SuppressWarnings({"WMI", "unchecked"}) public DBObject callLifecycleMethods(final Class<? extends Annotation> event, final Object entity, final DBObject dbObj, final Mapper mapper) { final List<ClassMethodPair> methodPairs = getLifecycleMethods((Class<Annotation>) e...
java
@SuppressWarnings({"WMI", "unchecked"}) public DBObject callLifecycleMethods(final Class<? extends Annotation> event, final Object entity, final DBObject dbObj, final Mapper mapper) { final List<ClassMethodPair> methodPairs = getLifecycleMethods((Class<Annotation>) e...
[ "@", "SuppressWarnings", "(", "{", "\"WMI\"", ",", "\"unchecked\"", "}", ")", "public", "DBObject", "callLifecycleMethods", "(", "final", "Class", "<", "?", "extends", "Annotation", ">", "event", ",", "final", "Object", "entity", ",", "final", "DBObject", "dbO...
Call the lifecycle methods @param event the lifecycle annotation @param entity the entity to process @param dbObj the dbObject to use @param mapper the Mapper to use @return dbObj
[ "Call", "the", "lifecycle", "methods" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/MappedClass.java#L243-L298
112,736
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/MappedClass.java
MappedClass.getAnnotation
public Annotation getAnnotation(final Class<? extends Annotation> clazz) { final List<Annotation> found = foundAnnotations.get(clazz); return found == null || found.isEmpty() ? null : found.get(found.size() - 1); }
java
public Annotation getAnnotation(final Class<? extends Annotation> clazz) { final List<Annotation> found = foundAnnotations.get(clazz); return found == null || found.isEmpty() ? null : found.get(found.size() - 1); }
[ "public", "Annotation", "getAnnotation", "(", "final", "Class", "<", "?", "extends", "Annotation", ">", "clazz", ")", "{", "final", "List", "<", "Annotation", ">", "found", "=", "foundAnnotations", ".", "get", "(", "clazz", ")", ";", "return", "found", "==...
Looks for an annotation of the type given @param clazz the type to search for @return the instance if it was found, if more than one was found, the last one added
[ "Looks", "for", "an", "annotation", "of", "the", "type", "given" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/MappedClass.java#L316-L319
112,737
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/MappedClass.java
MappedClass.getAnnotations
@SuppressWarnings("unchecked") public <T> List<T> getAnnotations(final Class<? extends Annotation> clazz) { return (List<T>) foundAnnotations.get(clazz); }
java
@SuppressWarnings("unchecked") public <T> List<T> getAnnotations(final Class<? extends Annotation> clazz) { return (List<T>) foundAnnotations.get(clazz); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "List", "<", "T", ">", "getAnnotations", "(", "final", "Class", "<", "?", "extends", "Annotation", ">", "clazz", ")", "{", "return", "(", "List", "<", "T", ">", ")", "foundAnn...
Looks for an annotation in the annotations found on a class while mapping @param clazz the class to search for @param <T> the type of annotation to find @return the instance if it was found, if more than one was found, the last one added
[ "Looks", "for", "an", "annotation", "in", "the", "annotations", "found", "on", "a", "class", "while", "mapping" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/MappedClass.java#L328-L331
112,738
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/MappedClass.java
MappedClass.getFieldsAnnotatedWith
public List<MappedField> getFieldsAnnotatedWith(final Class<? extends Annotation> clazz) { final List<MappedField> results = new ArrayList<MappedField>(); for (final MappedField mf : persistenceFields) { if (mf.hasAnnotation(clazz)) { results.add(mf); } } ...
java
public List<MappedField> getFieldsAnnotatedWith(final Class<? extends Annotation> clazz) { final List<MappedField> results = new ArrayList<MappedField>(); for (final MappedField mf : persistenceFields) { if (mf.hasAnnotation(clazz)) { results.add(mf); } } ...
[ "public", "List", "<", "MappedField", ">", "getFieldsAnnotatedWith", "(", "final", "Class", "<", "?", "extends", "Annotation", ">", "clazz", ")", "{", "final", "List", "<", "MappedField", ">", "results", "=", "new", "ArrayList", "<", "MappedField", ">", "(",...
Returns fields annotated with the clazz @param clazz The Annotation to find. @return the list of fields
[ "Returns", "fields", "annotated", "with", "the", "clazz" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/MappedClass.java#L370-L378
112,739
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/MappedClass.java
MappedClass.getFirstAnnotation
public Annotation getFirstAnnotation(final Class<? extends Annotation> clazz) { final List<Annotation> found = foundAnnotations.get(clazz); return found == null || found.isEmpty() ? null : found.get(0); }
java
public Annotation getFirstAnnotation(final Class<? extends Annotation> clazz) { final List<Annotation> found = foundAnnotations.get(clazz); return found == null || found.isEmpty() ? null : found.get(0); }
[ "public", "Annotation", "getFirstAnnotation", "(", "final", "Class", "<", "?", "extends", "Annotation", ">", "clazz", ")", "{", "final", "List", "<", "Annotation", ">", "found", "=", "foundAnnotations", ".", "get", "(", "clazz", ")", ";", "return", "found", ...
Returns the first found Annotation, or null. @param clazz The Annotation to find. @return First found Annotation or null of none found.
[ "Returns", "the", "first", "found", "Annotation", "or", "null", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/MappedClass.java#L386-L389
112,740
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/MappedClass.java
MappedClass.getMappedField
public MappedField getMappedField(final String storedName) { for (final MappedField mf : persistenceFields) { for (final String n : mf.getLoadNames()) { if (storedName.equals(n)) { return mf; } } } return null; }
java
public MappedField getMappedField(final String storedName) { for (final MappedField mf : persistenceFields) { for (final String n : mf.getLoadNames()) { if (storedName.equals(n)) { return mf; } } } return null; }
[ "public", "MappedField", "getMappedField", "(", "final", "String", "storedName", ")", "{", "for", "(", "final", "MappedField", "mf", ":", "persistenceFields", ")", "{", "for", "(", "final", "String", "n", ":", "mf", ".", "getLoadNames", "(", ")", ")", "{",...
Returns the MappedField by the name that it will stored in mongodb as @param storedName the name to search for @return true if that mapped field name is found
[ "Returns", "the", "MappedField", "by", "the", "name", "that", "it", "will", "stored", "in", "mongodb", "as" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/MappedClass.java#L408-L418
112,741
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/MappedClass.java
MappedClass.getMappedFieldByJavaField
public MappedField getMappedFieldByJavaField(final String name) { for (final MappedField mf : persistenceFields) { if (name.equals(mf.getJavaFieldName())) { return mf; } } return null; }
java
public MappedField getMappedFieldByJavaField(final String name) { for (final MappedField mf : persistenceFields) { if (name.equals(mf.getJavaFieldName())) { return mf; } } return null; }
[ "public", "MappedField", "getMappedFieldByJavaField", "(", "final", "String", "name", ")", "{", "for", "(", "final", "MappedField", "mf", ":", "persistenceFields", ")", "{", "if", "(", "name", ".", "equals", "(", "mf", ".", "getJavaFieldName", "(", ")", ")",...
Returns MappedField for a given java field name on the this MappedClass @param name the Java field name to search for @return the MappedField for the named Java field
[ "Returns", "MappedField", "for", "a", "given", "java", "field", "name", "on", "the", "this", "MappedClass" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/MappedClass.java#L426-L434
112,742
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/MappedClass.java
MappedClass.validate
@SuppressWarnings("deprecation") public void validate(final Mapper mapper) { new MappingValidator(mapper.getOptions().getObjectFactory()).validate(mapper, this); }
java
@SuppressWarnings("deprecation") public void validate(final Mapper mapper) { new MappingValidator(mapper.getOptions().getObjectFactory()).validate(mapper, this); }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "public", "void", "validate", "(", "final", "Mapper", "mapper", ")", "{", "new", "MappingValidator", "(", "mapper", ".", "getOptions", "(", ")", ".", "getObjectFactory", "(", ")", ")", ".", "validate", "(...
Validates this MappedClass @param mapper the Mapper to use for validation
[ "Validates", "this", "MappedClass" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/MappedClass.java#L513-L516
112,743
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/query/validation/ValueValidator.java
ValueValidator.apply
public boolean apply(final Class<?> type, final Object value, final List<ValidationFailure> validationFailures) { if (getRequiredValueType().isAssignableFrom(value.getClass())) { validate(type, value, validationFailures); return true; } return false; }
java
public boolean apply(final Class<?> type, final Object value, final List<ValidationFailure> validationFailures) { if (getRequiredValueType().isAssignableFrom(value.getClass())) { validate(type, value, validationFailures); return true; } return false; }
[ "public", "boolean", "apply", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "Object", "value", ",", "final", "List", "<", "ValidationFailure", ">", "validationFailures", ")", "{", "if", "(", "getRequiredValueType", "(", ")", ".", "isAssignableF...
Applied validation for the given field. If the value does not match the correct type, the validation is not applied and this method returns false. If the value is to be validated, then the validate method is called to see if the value and type are compatible. Errors are appended to the validationFailures list. @para...
[ "Applied", "validation", "for", "the", "given", "field", ".", "If", "the", "value", "does", "not", "match", "the", "correct", "type", "the", "validation", "is", "not", "applied", "and", "this", "method", "returns", "false", ".", "If", "the", "value", "is",...
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/query/validation/ValueValidator.java#L20-L26
112,744
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/geo/GeoJson.java
GeoJson.polygon
public static Polygon polygon(final LineString exteriorBoundary, final LineString... interiorBoundaries) { ensurePolygonIsClosed(exteriorBoundary); for (final LineString boundary : interiorBoundaries) { ensurePolygonIsClosed(boundary); } return new Polygon(exteriorBoundary, i...
java
public static Polygon polygon(final LineString exteriorBoundary, final LineString... interiorBoundaries) { ensurePolygonIsClosed(exteriorBoundary); for (final LineString boundary : interiorBoundaries) { ensurePolygonIsClosed(boundary); } return new Polygon(exteriorBoundary, i...
[ "public", "static", "Polygon", "polygon", "(", "final", "LineString", "exteriorBoundary", ",", "final", "LineString", "...", "interiorBoundaries", ")", "{", "ensurePolygonIsClosed", "(", "exteriorBoundary", ")", ";", "for", "(", "final", "LineString", "boundary", ":...
Lets you create a Polygon representing a GeoJSON Polygon type. This method is especially useful for defining polygons with inner rings. @param exteriorBoundary a LineString that contains a series of Points that make up the polygon. The first and last points should be the same to close the polygon @param interiorBou...
[ "Lets", "you", "create", "a", "Polygon", "representing", "a", "GeoJSON", "Polygon", "type", ".", "This", "method", "is", "especially", "useful", "for", "defining", "polygons", "with", "inner", "rings", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/geo/GeoJson.java#L82-L88
112,745
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/query/internal/MorphiaCursor.java
MorphiaCursor.toList
public List<T> toList() { final List<T> results = new ArrayList<T>(); try { while (wrapped.hasNext()) { results.add(next()); } } finally { wrapped.close(); } return results; }
java
public List<T> toList() { final List<T> results = new ArrayList<T>(); try { while (wrapped.hasNext()) { results.add(next()); } } finally { wrapped.close(); } return results; }
[ "public", "List", "<", "T", ">", "toList", "(", ")", "{", "final", "List", "<", "T", ">", "results", "=", "new", "ArrayList", "<", "T", ">", "(", ")", ";", "try", "{", "while", "(", "wrapped", ".", "hasNext", "(", ")", ")", "{", "results", ".",...
Converts this cursor to a List. Care should be taken on large datasets as OutOfMemoryErrors are a risk. @return the list of Entities
[ "Converts", "this", "cursor", "to", "a", "List", ".", "Care", "should", "be", "taken", "on", "large", "datasets", "as", "OutOfMemoryErrors", "are", "a", "risk", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/query/internal/MorphiaCursor.java#L53-L63
112,746
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/DatastoreImpl.java
DatastoreImpl.copy
@Deprecated public DatastoreImpl copy(final String database) { return new DatastoreImpl(morphia, mapper, mongoClient, database); }
java
@Deprecated public DatastoreImpl copy(final String database) { return new DatastoreImpl(morphia, mapper, mongoClient, database); }
[ "@", "Deprecated", "public", "DatastoreImpl", "copy", "(", "final", "String", "database", ")", "{", "return", "new", "DatastoreImpl", "(", "morphia", ",", "mapper", ",", "mongoClient", ",", "database", ")", ";", "}" ]
Creates a copy of this Datastore and all its configuration but with a new database @param database the new database to use for operations @return the new Datastore instance @deprecated use {@link Morphia#createDatastore(MongoClient, Mapper, String)}
[ "Creates", "a", "copy", "of", "this", "Datastore", "and", "all", "its", "configuration", "but", "with", "a", "new", "database" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/DatastoreImpl.java#L140-L143
112,747
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/DatastoreImpl.java
DatastoreImpl.find
public <T, V> Query<T> find(final String collection, final Class<T> clazz, final String property, final V value, final int offset, final int size, final boolean validate) { final Query<T> query = find(collection, clazz); if (!validate) { query.disableValidatio...
java
public <T, V> Query<T> find(final String collection, final Class<T> clazz, final String property, final V value, final int offset, final int size, final boolean validate) { final Query<T> query = find(collection, clazz); if (!validate) { query.disableValidatio...
[ "public", "<", "T", ",", "V", ">", "Query", "<", "T", ">", "find", "(", "final", "String", "collection", ",", "final", "Class", "<", "T", ">", "clazz", ",", "final", "String", "property", ",", "final", "V", "value", ",", "final", "int", "offset", "...
Find all instances by type in a different collection than what is mapped on the class given skipping some documents and returning a fixed number of the remaining. @param collection The collection use when querying @param clazz the class to use for mapping the results @param property the document property to que...
[ "Find", "all", "instances", "by", "type", "in", "a", "different", "collection", "than", "what", "is", "mapped", "on", "the", "class", "given", "skipping", "some", "documents", "and", "returning", "a", "fixed", "number", "of", "the", "remaining", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/DatastoreImpl.java#L1151-L1160
112,748
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/DatastoreImpl.java
DatastoreImpl.insert
@Override public <T> Iterable<Key<T>> insert(final Iterable<T> entities) { return insert(entities, new InsertOptions() .writeConcern(defConcern)); }
java
@Override public <T> Iterable<Key<T>> insert(final Iterable<T> entities) { return insert(entities, new InsertOptions() .writeConcern(defConcern)); }
[ "@", "Override", "public", "<", "T", ">", "Iterable", "<", "Key", "<", "T", ">", ">", "insert", "(", "final", "Iterable", "<", "T", ">", "entities", ")", "{", "return", "insert", "(", "entities", ",", "new", "InsertOptions", "(", ")", ".", "writeConc...
Inserts entities in to the database @param entities the entities to insert @param <T> the type of the entities @return the keys of entities
[ "Inserts", "entities", "in", "to", "the", "database" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/DatastoreImpl.java#L1185-L1189
112,749
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/DatastoreImpl.java
DatastoreImpl.insert
public <T> Key<T> insert(final String collection, final T entity, final WriteConcern wc) { return insert(getCollection(collection), ProxyHelper.unwrap(entity), new InsertOptions().writeConcern(wc)); }
java
public <T> Key<T> insert(final String collection, final T entity, final WriteConcern wc) { return insert(getCollection(collection), ProxyHelper.unwrap(entity), new InsertOptions().writeConcern(wc)); }
[ "public", "<", "T", ">", "Key", "<", "T", ">", "insert", "(", "final", "String", "collection", ",", "final", "T", "entity", ",", "final", "WriteConcern", "wc", ")", "{", "return", "insert", "(", "getCollection", "(", "collection", ")", ",", "ProxyHelper"...
Inserts an entity in to the database @param collection the collection to query against @param entity the entity to insert @param wc the WriteConcern to use when deleting @param <T> the type of the entities @return the key of entity
[ "Inserts", "an", "entity", "in", "to", "the", "database" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/DatastoreImpl.java#L1200-L1202
112,750
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/DatastoreImpl.java
DatastoreImpl.getWriteConcern
private WriteConcern getWriteConcern(final Object clazzOrEntity) { WriteConcern wc = defConcern; if (clazzOrEntity != null) { final Entity entityAnn = getMapper().getMappedClass(clazzOrEntity).getEntityAnnotation(); if (entityAnn != null && !entityAnn.concern().isEmpty()) { ...
java
private WriteConcern getWriteConcern(final Object clazzOrEntity) { WriteConcern wc = defConcern; if (clazzOrEntity != null) { final Entity entityAnn = getMapper().getMappedClass(clazzOrEntity).getEntityAnnotation(); if (entityAnn != null && !entityAnn.concern().isEmpty()) { ...
[ "private", "WriteConcern", "getWriteConcern", "(", "final", "Object", "clazzOrEntity", ")", "{", "WriteConcern", "wc", "=", "defConcern", ";", "if", "(", "clazzOrEntity", "!=", "null", ")", "{", "final", "Entity", "entityAnn", "=", "getMapper", "(", ")", ".", ...
Gets the write concern for entity or returns the default write concern for this datastore @param clazzOrEntity the class or entity to use when looking up the WriteConcern
[ "Gets", "the", "write", "concern", "for", "entity", "or", "returns", "the", "default", "write", "concern", "for", "this", "datastore" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/DatastoreImpl.java#L1589-L1599
112,751
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/lazy/LazyFeatureDependencies.java
LazyFeatureDependencies.createDefaultProxyFactory
public static LazyProxyFactory createDefaultProxyFactory() { if (testDependencyFullFilled()) { final String factoryClassName = "dev.morphia.mapping.lazy.CGLibLazyProxyFactory"; try { return (LazyProxyFactory) Class.forName(factoryClassName).newInstance(); } ca...
java
public static LazyProxyFactory createDefaultProxyFactory() { if (testDependencyFullFilled()) { final String factoryClassName = "dev.morphia.mapping.lazy.CGLibLazyProxyFactory"; try { return (LazyProxyFactory) Class.forName(factoryClassName).newInstance(); } ca...
[ "public", "static", "LazyProxyFactory", "createDefaultProxyFactory", "(", ")", "{", "if", "(", "testDependencyFullFilled", "(", ")", ")", "{", "final", "String", "factoryClassName", "=", "\"dev.morphia.mapping.lazy.CGLibLazyProxyFactory\"", ";", "try", "{", "return", "(...
Creates a LazyProxyFactory @return the LazyProxyFactory
[ "Creates", "a", "LazyProxyFactory" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/lazy/LazyFeatureDependencies.java#L56-L66
112,752
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/logging/MorphiaLoggerFactory.java
MorphiaLoggerFactory.registerLogger
public static void registerLogger(final Class<? extends LoggerFactory> factoryClass) { if (loggerFactory == null) { FACTORIES.add(0, factoryClass.getName()); } else { throw new IllegalStateException("LoggerImplFactory must be registered before logging is initialized."); }...
java
public static void registerLogger(final Class<? extends LoggerFactory> factoryClass) { if (loggerFactory == null) { FACTORIES.add(0, factoryClass.getName()); } else { throw new IllegalStateException("LoggerImplFactory must be registered before logging is initialized."); }...
[ "public", "static", "void", "registerLogger", "(", "final", "Class", "<", "?", "extends", "LoggerFactory", ">", "factoryClass", ")", "{", "if", "(", "loggerFactory", "==", "null", ")", "{", "FACTORIES", ".", "add", "(", "0", ",", "factoryClass", ".", "getN...
Register a LoggerFactory; last one registered is used. @param factoryClass the factory class
[ "Register", "a", "LoggerFactory", ";", "last", "one", "registered", "is", "used", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/logging/MorphiaLoggerFactory.java#L64-L70
112,753
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/converters/Converters.java
Converters.addConverter
public TypeConverter addConverter(final Class<? extends TypeConverter> clazz) { return addConverter(mapper.getOptions().getObjectFactory().createInstance(clazz)); }
java
public TypeConverter addConverter(final Class<? extends TypeConverter> clazz) { return addConverter(mapper.getOptions().getObjectFactory().createInstance(clazz)); }
[ "public", "TypeConverter", "addConverter", "(", "final", "Class", "<", "?", "extends", "TypeConverter", ">", "clazz", ")", "{", "return", "addConverter", "(", "mapper", ".", "getOptions", "(", ")", ".", "getObjectFactory", "(", ")", ".", "createInstance", "(",...
Adds a TypeConverter to this bundle. @param clazz the converter to add @return the new instance
[ "Adds", "a", "TypeConverter", "to", "this", "bundle", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/converters/Converters.java#L57-L59
112,754
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/converters/Converters.java
Converters.addConverter
public TypeConverter addConverter(final TypeConverter tc) { if (tc.getSupportedTypes() != null) { for (final Class c : tc.getSupportedTypes()) { addTypedConverter(c, tc); } } else { untypedTypeEncoders.add(tc); } registeredConverterCla...
java
public TypeConverter addConverter(final TypeConverter tc) { if (tc.getSupportedTypes() != null) { for (final Class c : tc.getSupportedTypes()) { addTypedConverter(c, tc); } } else { untypedTypeEncoders.add(tc); } registeredConverterCla...
[ "public", "TypeConverter", "addConverter", "(", "final", "TypeConverter", "tc", ")", "{", "if", "(", "tc", ".", "getSupportedTypes", "(", ")", "!=", "null", ")", "{", "for", "(", "final", "Class", "c", ":", "tc", ".", "getSupportedTypes", "(", ")", ")", ...
Add a type converter. If it is a duplicate for an existing type, it will override that type. @param tc the converter to add @return the TypeConverter passed in
[ "Add", "a", "type", "converter", ".", "If", "it", "is", "a", "duplicate", "for", "an", "existing", "type", "it", "will", "override", "that", "type", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/converters/Converters.java#L67-L80
112,755
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/converters/Converters.java
Converters.removeConverter
public void removeConverter(final TypeConverter tc) { if (tc.getSupportedTypes() == null) { untypedTypeEncoders.remove(tc); registeredConverterClasses.remove(tc.getClass()); } else { for (final Entry<Class, List<TypeConverter>> entry : tcMap.entrySet()) { ...
java
public void removeConverter(final TypeConverter tc) { if (tc.getSupportedTypes() == null) { untypedTypeEncoders.remove(tc); registeredConverterClasses.remove(tc.getClass()); } else { for (final Entry<Class, List<TypeConverter>> entry : tcMap.entrySet()) { ...
[ "public", "void", "removeConverter", "(", "final", "TypeConverter", "tc", ")", "{", "if", "(", "tc", ".", "getSupportedTypes", "(", ")", "==", "null", ")", "{", "untypedTypeEncoders", ".", "remove", "(", "tc", ")", ";", "registeredConverterClasses", ".", "re...
Removes the type converter. @param tc the converter to remove
[ "Removes", "the", "type", "converter", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/converters/Converters.java#L212-L229
112,756
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/converters/Converters.java
Converters.toDBObject
public void toDBObject(final Object containingObject, final MappedField mf, final DBObject dbObj, final MapperOptions opts) { final Object fieldValue = mf.getFieldValue(containingObject); final TypeConverter enc = getEncoder(fieldValue, mf); final Object encoded = enc.encode(fieldValue, mf); ...
java
public void toDBObject(final Object containingObject, final MappedField mf, final DBObject dbObj, final MapperOptions opts) { final Object fieldValue = mf.getFieldValue(containingObject); final TypeConverter enc = getEncoder(fieldValue, mf); final Object encoded = enc.encode(fieldValue, mf); ...
[ "public", "void", "toDBObject", "(", "final", "Object", "containingObject", ",", "final", "MappedField", "mf", ",", "final", "DBObject", "dbObj", ",", "final", "MapperOptions", "opts", ")", "{", "final", "Object", "fieldValue", "=", "mf", ".", "getFieldValue", ...
Converts an entity to a DBObject @param containingObject The object to convert @param mf the MappedField to extract @param dbObj the DBObject to populate @param opts the options to apply
[ "Converts", "an", "entity", "to", "a", "DBObject" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/converters/Converters.java#L239-L247
112,757
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/MappedField.java
MappedField.getFieldValue
public Object getFieldValue(final Object instance) { try { return field.get(instance); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
java
public Object getFieldValue(final Object instance) { try { return field.get(instance); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
[ "public", "Object", "getFieldValue", "(", "final", "Object", "instance", ")", "{", "try", "{", "return", "field", ".", "get", "(", "instance", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e...
Gets the value of the field mapped on the instance given. @param instance the instance to use @return the value stored in the java field
[ "Gets", "the", "value", "of", "the", "field", "mapped", "on", "the", "instance", "given", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/MappedField.java#L243-L249
112,758
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/MappedField.java
MappedField.getFirstFieldName
public String getFirstFieldName(final DBObject dbObj) { String fieldName = getNameToStore(); boolean foundField = false; for (final String n : getLoadNames()) { if (dbObj.containsField(n)) { if (!foundField) { foundField = true; ...
java
public String getFirstFieldName(final DBObject dbObj) { String fieldName = getNameToStore(); boolean foundField = false; for (final String n : getLoadNames()) { if (dbObj.containsField(n)) { if (!foundField) { foundField = true; ...
[ "public", "String", "getFirstFieldName", "(", "final", "DBObject", "dbObj", ")", "{", "String", "fieldName", "=", "getNameToStore", "(", ")", ";", "boolean", "foundField", "=", "false", ";", "for", "(", "final", "String", "n", ":", "getLoadNames", "(", ")", ...
Gets the field name to use when converting from a DBObject @param dbObj the DBObject to scan for alternate names @return the value of this field mapped from the DBObject @see AlsoLoad
[ "Gets", "the", "field", "name", "to", "use", "when", "converting", "from", "a", "DBObject" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/MappedField.java#L258-L272
112,759
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/MappedField.java
MappedField.setFieldValue
public void setFieldValue(final Object instance, final Object value) { try { field.set(instance, value); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
java
public void setFieldValue(final Object instance, final Object value) { try { field.set(instance, value); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
[ "public", "void", "setFieldValue", "(", "final", "Object", "instance", ",", "final", "Object", "value", ")", "{", "try", "{", "field", ".", "set", "(", "instance", ",", "value", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "throw...
Sets the value for the java field @param instance the instance to update @param value the value to set
[ "Sets", "the", "value", "for", "the", "java", "field" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/MappedField.java#L450-L456
112,760
MorphiaOrg/morphia
morphia/src/main/java/relocated/morphia/org/apache/commons/collections/ReferenceMap.java
ReferenceMap.verify
private static void verify(final String name, final int type) { if ((type < HARD) || (type > WEAK)) { throw new IllegalArgumentException(name + " must be HARD, SOFT, WEAK."); } }
java
private static void verify(final String name, final int type) { if ((type < HARD) || (type > WEAK)) { throw new IllegalArgumentException(name + " must be HARD, SOFT, WEAK."); } }
[ "private", "static", "void", "verify", "(", "final", "String", "name", ",", "final", "int", "type", ")", "{", "if", "(", "(", "type", "<", "HARD", ")", "||", "(", "type", ">", "WEAK", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "n...
used by constructor
[ "used", "by", "constructor" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/relocated/morphia/org/apache/commons/collections/ReferenceMap.java#L229-L233
112,761
MorphiaOrg/morphia
morphia/src/main/java/relocated/morphia/org/apache/commons/collections/ReferenceMap.java
ReferenceMap.clear
@Override public void clear() { Arrays.fill(table, null); size = 0; //noinspection StatementWithEmptyBody while (queue.poll() != null) { // drain the queue } }
java
@Override public void clear() { Arrays.fill(table, null); size = 0; //noinspection StatementWithEmptyBody while (queue.poll() != null) { // drain the queue } }
[ "@", "Override", "public", "void", "clear", "(", ")", "{", "Arrays", ".", "fill", "(", "table", ",", "null", ")", ";", "size", "=", "0", ";", "//noinspection StatementWithEmptyBody\r", "while", "(", "queue", ".", "poll", "(", ")", "!=", "null", ")", "{...
Clears this map.
[ "Clears", "this", "map", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/relocated/morphia/org/apache/commons/collections/ReferenceMap.java#L364-L372
112,762
MorphiaOrg/morphia
morphia/src/main/java/relocated/morphia/org/apache/commons/collections/ReferenceMap.java
ReferenceMap.keySet
@Override public Set keySet() { if (keySet != null) { return keySet; } keySet = new AbstractSet() { @Override public Iterator iterator() { return new KeyIterator(); } @Override public int size() ...
java
@Override public Set keySet() { if (keySet != null) { return keySet; } keySet = new AbstractSet() { @Override public Iterator iterator() { return new KeyIterator(); } @Override public int size() ...
[ "@", "Override", "public", "Set", "keySet", "(", ")", "{", "if", "(", "keySet", "!=", "null", ")", "{", "return", "keySet", ";", "}", "keySet", "=", "new", "AbstractSet", "(", ")", "{", "@", "Override", "public", "Iterator", "iterator", "(", ")", "{"...
Returns a set view of this map's keys. @return a set view of this map's keys
[ "Returns", "a", "set", "view", "of", "this", "map", "s", "keys", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/relocated/morphia/org/apache/commons/collections/ReferenceMap.java#L379-L414
112,763
MorphiaOrg/morphia
morphia/src/main/java/relocated/morphia/org/apache/commons/collections/ReferenceMap.java
ReferenceMap.entrySet
@Override public Set entrySet() { if (entrySet != null) { return entrySet; } entrySet = new AbstractSet() { @Override public int size() { return ReferenceMap.this.size(); } @Override public...
java
@Override public Set entrySet() { if (entrySet != null) { return entrySet; } entrySet = new AbstractSet() { @Override public int size() { return ReferenceMap.this.size(); } @Override public...
[ "@", "Override", "public", "Set", "entrySet", "(", ")", "{", "if", "(", "entrySet", "!=", "null", ")", "{", "return", "entrySet", ";", "}", "entrySet", "=", "new", "AbstractSet", "(", ")", "{", "@", "Override", "public", "int", "size", "(", ")", "{",...
Returns a set view of this map's entries. @return a set view of this map's entries
[ "Returns", "a", "set", "view", "of", "this", "map", "s", "entries", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/relocated/morphia/org/apache/commons/collections/ReferenceMap.java#L450-L517
112,764
MorphiaOrg/morphia
morphia/src/main/java/relocated/morphia/org/apache/commons/collections/ReferenceMap.java
ReferenceMap.readObject
private void readObject(final ObjectInputStream inp) throws IOException, ClassNotFoundException { inp.defaultReadObject(); table = new Entry[inp.readInt()]; threshold = (int) (table.length * loadFactor); queue = new ReferenceQueue(); Object key = inp.readObject(); w...
java
private void readObject(final ObjectInputStream inp) throws IOException, ClassNotFoundException { inp.defaultReadObject(); table = new Entry[inp.readInt()]; threshold = (int) (table.length * loadFactor); queue = new ReferenceQueue(); Object key = inp.readObject(); w...
[ "private", "void", "readObject", "(", "final", "ObjectInputStream", "inp", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "inp", ".", "defaultReadObject", "(", ")", ";", "table", "=", "new", "Entry", "[", "inp", ".", "readInt", "(", ")", "...
Reads the contents of this object from the given input stream. @param inp the input stream to read from @throws IOException if the stream raises it @throws ClassNotFoundException if the stream raises it
[ "Reads", "the", "contents", "of", "this", "object", "from", "the", "given", "input", "stream", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/relocated/morphia/org/apache/commons/collections/ReferenceMap.java#L602-L613
112,765
MorphiaOrg/morphia
morphia/src/main/java/relocated/morphia/org/apache/commons/collections/ReferenceMap.java
ReferenceMap.resize
private void resize() { final Entry[] old = table; table = new Entry[old.length * 2]; for (int i = 0; i < old.length; i++) { Entry next = old[i]; while (next != null) { final Entry entry = next; next = next.next; f...
java
private void resize() { final Entry[] old = table; table = new Entry[old.length * 2]; for (int i = 0; i < old.length; i++) { Entry next = old[i]; while (next != null) { final Entry entry = next; next = next.next; f...
[ "private", "void", "resize", "(", ")", "{", "final", "Entry", "[", "]", "old", "=", "table", ";", "table", "=", "new", "Entry", "[", "old", ".", "length", "*", "2", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "old", ".", "lengt...
Resizes this hash table by doubling its capacity. This is an expensive operation, as entries must be copied from the old smaller table to the new bigger table.
[ "Resizes", "this", "hash", "table", "by", "doubling", "its", "capacity", ".", "This", "is", "an", "expensive", "operation", "as", "entries", "must", "be", "copied", "from", "the", "old", "smaller", "table", "to", "the", "new", "bigger", "table", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/relocated/morphia/org/apache/commons/collections/ReferenceMap.java#L619-L635
112,766
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/DeleteOptions.java
DeleteOptions.copy
public DeleteOptions copy() { DeleteOptions deleteOptions = new DeleteOptions() .writeConcern(getWriteConcern()); if (getCollation() != null) { deleteOptions.collation(Collation.builder(getCollation()).build()); } return deleteOptions; }
java
public DeleteOptions copy() { DeleteOptions deleteOptions = new DeleteOptions() .writeConcern(getWriteConcern()); if (getCollation() != null) { deleteOptions.collation(Collation.builder(getCollation()).build()); } return deleteOptions; }
[ "public", "DeleteOptions", "copy", "(", ")", "{", "DeleteOptions", "deleteOptions", "=", "new", "DeleteOptions", "(", ")", ".", "writeConcern", "(", "getWriteConcern", "(", ")", ")", ";", "if", "(", "getCollation", "(", ")", "!=", "null", ")", "{", "delete...
Copies this instance to a new one. @return the new instance
[ "Copies", "this", "instance", "to", "a", "new", "one", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/DeleteOptions.java#L43-L52
112,767
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/query/QueryImpl.java
QueryImpl.parseFieldsString
@Deprecated public static BasicDBObject parseFieldsString(final String str, final Class clazz, final Mapper mapper, final boolean validate) { BasicDBObject ret = new BasicDBObject(); final String[] parts = str.split(","); for (String s : parts) { s = s.trim(); int dir...
java
@Deprecated public static BasicDBObject parseFieldsString(final String str, final Class clazz, final Mapper mapper, final boolean validate) { BasicDBObject ret = new BasicDBObject(); final String[] parts = str.split(","); for (String s : parts) { s = s.trim(); int dir...
[ "@", "Deprecated", "public", "static", "BasicDBObject", "parseFieldsString", "(", "final", "String", "str", ",", "final", "Class", "clazz", ",", "final", "Mapper", "mapper", ",", "final", "boolean", "validate", ")", "{", "BasicDBObject", "ret", "=", "new", "Ba...
Parses the string and validates each part @param str the String to parse @param clazz the class to use when validating @param mapper the Mapper to use @param validate true if the results should be validated @return the DBObject @deprecated this is an internal method and will be removed in the next version
[ "Parses", "the", "string", "and", "validates", "each", "part" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/query/QueryImpl.java#L101-L120
112,768
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/aggregation/Projection.java
Projection.projection
public static Projection projection(final String field, final Projection projection, final Projection... subsequent) { return new Projection(field, projection, subsequent); }
java
public static Projection projection(final String field, final Projection projection, final Projection... subsequent) { return new Projection(field, projection, subsequent); }
[ "public", "static", "Projection", "projection", "(", "final", "String", "field", ",", "final", "Projection", "projection", ",", "final", "Projection", "...", "subsequent", ")", "{", "return", "new", "Projection", "(", "field", ",", "projection", ",", "subsequent...
Creates a projection on a field with subsequent projects applied. @param field the field @param projection the project to apply @param subsequent the other projections to apply @return the projection
[ "Creates", "a", "projection", "on", "a", "field", "with", "subsequent", "projects", "applied", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/aggregation/Projection.java#L72-L74
112,769
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/MapreduceResults.java
MapreduceResults.iterator
@Override public Iterator<T> iterator() { return outputType == OutputType.INLINE ? getInlineResults() : createQuery().fetch().iterator(); }
java
@Override public Iterator<T> iterator() { return outputType == OutputType.INLINE ? getInlineResults() : createQuery().fetch().iterator(); }
[ "@", "Override", "public", "Iterator", "<", "T", ">", "iterator", "(", ")", "{", "return", "outputType", "==", "OutputType", ".", "INLINE", "?", "getInlineResults", "(", ")", ":", "createQuery", "(", ")", ".", "fetch", "(", ")", ".", "iterator", "(", "...
Creates an Iterator over the results of the operation. @return the Iterator
[ "Creates", "an", "Iterator", "over", "the", "results", "of", "the", "operation", "." ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/MapreduceResults.java#L152-L155
112,770
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/MapreduceResults.java
MapreduceResults.setInlineRequiredOptions
public void setInlineRequiredOptions(final Datastore datastore, final Class<T> clazz, final Mapper mapper, final EntityCache cache) { this.mapper = mapper; this.datastore = datastore; this.clazz = clazz; this.cache = cache; }
java
public void setInlineRequiredOptions(final Datastore datastore, final Class<T> clazz, final Mapper mapper, final EntityCache cache) { this.mapper = mapper; this.datastore = datastore; this.clazz = clazz; this.cache = cache; }
[ "public", "void", "setInlineRequiredOptions", "(", "final", "Datastore", "datastore", ",", "final", "Class", "<", "T", ">", "clazz", ",", "final", "Mapper", "mapper", ",", "final", "EntityCache", "cache", ")", "{", "this", ".", "mapper", "=", "mapper", ";", ...
Sets the required options when the operation type was INLINE @param datastore the Datastore to use when fetching this reference @param clazz the type of the results @param mapper the mapper to use @param cache the cache of entities seen so far @see OutputType
[ "Sets", "the", "required", "options", "when", "the", "operation", "type", "was", "INLINE" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/MapreduceResults.java#L166-L171
112,771
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/experimental/SingleReference.java
SingleReference.decode
public static MorphiaReference<?> decode(final Datastore datastore, final Mapper mapper, final MappedField mappedField, final Class paramType, final DBObject dbObject) { final M...
java
public static MorphiaReference<?> decode(final Datastore datastore, final Mapper mapper, final MappedField mappedField, final Class paramType, final DBObject dbObject) { final M...
[ "public", "static", "MorphiaReference", "<", "?", ">", "decode", "(", "final", "Datastore", "datastore", ",", "final", "Mapper", "mapper", ",", "final", "MappedField", "mappedField", ",", "final", "Class", "paramType", ",", "final", "DBObject", "dbObject", ")", ...
Decodes a document in to an entity @param datastore the datastore @param mapper the mapper @param mappedField the MappedField @param paramType the type of the underlying entity @param dbObject the DBObject to decode @return the entity
[ "Decodes", "a", "document", "in", "to", "an", "entity" ]
667c30bdc7c6f1d9f2e2eb8774835d6137b52d12
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/experimental/SingleReference.java#L92-L100
112,772
gaul/s3proxy
src/main/java/org/gaul/s3proxy/ChunkedInputStream.java
ChunkedInputStream.readLine
private static String readLine(InputStream is) throws IOException { StringBuilder builder = new StringBuilder(); while (true) { int ch = is.read(); if (ch == '\r') { ch = is.read(); if (ch == '\n') { break; } els...
java
private static String readLine(InputStream is) throws IOException { StringBuilder builder = new StringBuilder(); while (true) { int ch = is.read(); if (ch == '\r') { ch = is.read(); if (ch == '\n') { break; } els...
[ "private", "static", "String", "readLine", "(", "InputStream", "is", ")", "throws", "IOException", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "while", "(", "true", ")", "{", "int", "ch", "=", "is", ".", "read", "(", ")",...
Read a \r\n terminated line from an InputStream. @return line without the newline or empty String if InputStream is empty
[ "Read", "a", "\\", "r", "\\", "n", "terminated", "line", "from", "an", "InputStream", "." ]
6389e45670b6b57a2803e5789a8344a2705f9965
https://github.com/gaul/s3proxy/blob/6389e45670b6b57a2803e5789a8344a2705f9965/src/main/java/org/gaul/s3proxy/ChunkedInputStream.java#L86-L106
112,773
gaul/s3proxy
src/main/java/org/gaul/s3proxy/S3ProxyHandler.java
S3ProxyHandler.mapXmlAclsToCannedPolicy
private static String mapXmlAclsToCannedPolicy( AccessControlPolicy policy) throws S3Exception { if (!policy.owner.id.equals(FAKE_OWNER_ID)) { throw new S3Exception(S3ErrorCode.NOT_IMPLEMENTED); } boolean ownerFullControl = false; boolean allUsersRead = false; ...
java
private static String mapXmlAclsToCannedPolicy( AccessControlPolicy policy) throws S3Exception { if (!policy.owner.id.equals(FAKE_OWNER_ID)) { throw new S3Exception(S3ErrorCode.NOT_IMPLEMENTED); } boolean ownerFullControl = false; boolean allUsersRead = false; ...
[ "private", "static", "String", "mapXmlAclsToCannedPolicy", "(", "AccessControlPolicy", "policy", ")", "throws", "S3Exception", "{", "if", "(", "!", "policy", ".", "owner", ".", "id", ".", "equals", "(", "FAKE_OWNER_ID", ")", ")", "{", "throw", "new", "S3Except...
Map XML ACLs to a canned policy if an exact tranformation exists.
[ "Map", "XML", "ACLs", "to", "a", "canned", "policy", "if", "an", "exact", "tranformation", "exists", "." ]
6389e45670b6b57a2803e5789a8344a2705f9965
https://github.com/gaul/s3proxy/blob/6389e45670b6b57a2803e5789a8344a2705f9965/src/main/java/org/gaul/s3proxy/S3ProxyHandler.java#L1041-L1075
112,774
gaul/s3proxy
src/main/java/org/gaul/s3proxy/S3ProxyHandler.java
S3ProxyHandler.parseIso8601
private static long parseIso8601(String date) { SimpleDateFormat formatter = new SimpleDateFormat( "yyyyMMdd'T'HHmmss'Z'"); formatter.setTimeZone(TimeZone.getTimeZone("UTC")); logger.debug("8601date {}", date); try { return formatter.parse(date).getTime() / 10...
java
private static long parseIso8601(String date) { SimpleDateFormat formatter = new SimpleDateFormat( "yyyyMMdd'T'HHmmss'Z'"); formatter.setTimeZone(TimeZone.getTimeZone("UTC")); logger.debug("8601date {}", date); try { return formatter.parse(date).getTime() / 10...
[ "private", "static", "long", "parseIso8601", "(", "String", "date", ")", "{", "SimpleDateFormat", "formatter", "=", "new", "SimpleDateFormat", "(", "\"yyyyMMdd'T'HHmmss'Z'\"", ")", ";", "formatter", ".", "setTimeZone", "(", "TimeZone", ".", "getTimeZone", "(", "\"...
Parse ISO 8601 timestamp into seconds since 1970.
[ "Parse", "ISO", "8601", "timestamp", "into", "seconds", "since", "1970", "." ]
6389e45670b6b57a2803e5789a8344a2705f9965
https://github.com/gaul/s3proxy/blob/6389e45670b6b57a2803e5789a8344a2705f9965/src/main/java/org/gaul/s3proxy/S3ProxyHandler.java#L2782-L2792
112,775
gaul/s3proxy
src/main/java/org/gaul/s3proxy/S3ProxyHandler.java
S3ProxyHandler.formatDate
private static String formatDate(Date date) { SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss'Z'"); formatter.setTimeZone(TimeZone.getTimeZone("GMT")); return formatter.format(date); }
java
private static String formatDate(Date date) { SimpleDateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss'Z'"); formatter.setTimeZone(TimeZone.getTimeZone("GMT")); return formatter.format(date); }
[ "private", "static", "String", "formatDate", "(", "Date", "date", ")", "{", "SimpleDateFormat", "formatter", "=", "new", "SimpleDateFormat", "(", "\"yyyy-MM-dd'T'HH:mm:ss'Z'\"", ")", ";", "formatter", ".", "setTimeZone", "(", "TimeZone", ".", "getTimeZone", "(", "...
it has unwanted millisecond precision
[ "it", "has", "unwanted", "millisecond", "precision" ]
6389e45670b6b57a2803e5789a8344a2705f9965
https://github.com/gaul/s3proxy/blob/6389e45670b6b57a2803e5789a8344a2705f9965/src/main/java/org/gaul/s3proxy/S3ProxyHandler.java#L2807-L2812
112,776
gaul/s3proxy
src/main/java/org/gaul/s3proxy/S3ProxyHandler.java
S3ProxyHandler.encodeBlob
private static String encodeBlob(String encodingType, String blobName) { if (encodingType != null && encodingType.equals("url")) { return urlEscaper.escape(blobName); } else { return blobName; } }
java
private static String encodeBlob(String encodingType, String blobName) { if (encodingType != null && encodingType.equals("url")) { return urlEscaper.escape(blobName); } else { return blobName; } }
[ "private", "static", "String", "encodeBlob", "(", "String", "encodingType", ",", "String", "blobName", ")", "{", "if", "(", "encodingType", "!=", "null", "&&", "encodingType", ".", "equals", "(", "\"url\"", ")", ")", "{", "return", "urlEscaper", ".", "escape...
which XML 1.0 cannot represent.
[ "which", "XML", "1", ".", "0", "cannot", "represent", "." ]
6389e45670b6b57a2803e5789a8344a2705f9965
https://github.com/gaul/s3proxy/blob/6389e45670b6b57a2803e5789a8344a2705f9965/src/main/java/org/gaul/s3proxy/S3ProxyHandler.java#L2958-L2964
112,777
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/utils/Buffers.java
Buffers.readAsciiString
public static String readAsciiString(ByteBuffer buffer, int strLen) { byte[] bytes = new byte[strLen]; buffer.get(bytes); return new String(bytes); }
java
public static String readAsciiString(ByteBuffer buffer, int strLen) { byte[] bytes = new byte[strLen]; buffer.get(bytes); return new String(bytes); }
[ "public", "static", "String", "readAsciiString", "(", "ByteBuffer", "buffer", ",", "int", "strLen", ")", "{", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "strLen", "]", ";", "buffer", ".", "get", "(", "bytes", ")", ";", "return", "new", "String...
Read ascii string ,by len
[ "Read", "ascii", "string", "by", "len" ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/utils/Buffers.java#L57-L61
112,778
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/utils/Buffers.java
Buffers.readString
public static String readString(ByteBuffer buffer, int strLen) { StringBuilder sb = new StringBuilder(strLen); for (int i = 0; i < strLen; i++) { sb.append(buffer.getChar()); } return sb.toString(); }
java
public static String readString(ByteBuffer buffer, int strLen) { StringBuilder sb = new StringBuilder(strLen); for (int i = 0; i < strLen; i++) { sb.append(buffer.getChar()); } return sb.toString(); }
[ "public", "static", "String", "readString", "(", "ByteBuffer", "buffer", ",", "int", "strLen", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "strLen", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "strLen", ";", "i", ...
read utf16 strings, use strLen, not ending 0 char.
[ "read", "utf16", "strings", "use", "strLen", "not", "ending", "0", "char", "." ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/utils/Buffers.java#L66-L72
112,779
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/utils/Buffers.java
Buffers.readZeroTerminatedString
public static String readZeroTerminatedString(ByteBuffer buffer, int strLen) { StringBuilder sb = new StringBuilder(strLen); for (int i = 0; i < strLen; i++) { char c = buffer.getChar(); if (c == '\0') { skip(buffer, (strLen - i - 1) * 2); break; ...
java
public static String readZeroTerminatedString(ByteBuffer buffer, int strLen) { StringBuilder sb = new StringBuilder(strLen); for (int i = 0; i < strLen; i++) { char c = buffer.getChar(); if (c == '\0') { skip(buffer, (strLen - i - 1) * 2); break; ...
[ "public", "static", "String", "readZeroTerminatedString", "(", "ByteBuffer", "buffer", ",", "int", "strLen", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "strLen", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "strLen", ...
read utf16 strings, ending with 0 char.
[ "read", "utf16", "strings", "ending", "with", "0", "char", "." ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/utils/Buffers.java#L77-L88
112,780
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/utils/Buffers.java
Buffers.sliceAndSkip
public static ByteBuffer sliceAndSkip(ByteBuffer buffer, int size) { ByteBuffer buf = buffer.slice().order(ByteOrder.LITTLE_ENDIAN); ByteBuffer slice = (ByteBuffer) ((Buffer) buf).limit(buf.position() + size); skip(buffer, size); return slice; }
java
public static ByteBuffer sliceAndSkip(ByteBuffer buffer, int size) { ByteBuffer buf = buffer.slice().order(ByteOrder.LITTLE_ENDIAN); ByteBuffer slice = (ByteBuffer) ((Buffer) buf).limit(buf.position() + size); skip(buffer, size); return slice; }
[ "public", "static", "ByteBuffer", "sliceAndSkip", "(", "ByteBuffer", "buffer", ",", "int", "size", ")", "{", "ByteBuffer", "buf", "=", "buffer", ".", "slice", "(", ")", ".", "order", "(", "ByteOrder", ".", "LITTLE_ENDIAN", ")", ";", "ByteBuffer", "slice", ...
Return one new ByteBuffer from current position, with size, the byte order of new buffer will be set to little endian; And advance the original buffer with size.
[ "Return", "one", "new", "ByteBuffer", "from", "current", "position", "with", "size", "the", "byte", "order", "of", "new", "buffer", "will", "be", "set", "to", "little", "endian", ";", "And", "advance", "the", "original", "buffer", "with", "size", "." ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/utils/Buffers.java#L122-L127
112,781
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/struct/resource/ResourceTable.java
ResourceTable.getResourcesById
@Nonnull public List<Resource> getResourcesById(long resourceId) { // An Android Resource id is a 32-bit integer. It comprises // an 8-bit Package id [bits 24-31] // an 8-bit Type id [bits 16-23] // a 16-bit Entry index [bits 0-15] short packageId = (short) (resourceId >> 2...
java
@Nonnull public List<Resource> getResourcesById(long resourceId) { // An Android Resource id is a 32-bit integer. It comprises // an 8-bit Package id [bits 24-31] // an 8-bit Type id [bits 16-23] // a 16-bit Entry index [bits 0-15] short packageId = (short) (resourceId >> 2...
[ "@", "Nonnull", "public", "List", "<", "Resource", ">", "getResourcesById", "(", "long", "resourceId", ")", "{", "// An Android Resource id is a 32-bit integer. It comprises", "// an 8-bit Package id [bits 24-31]", "// an 8-bit Type id [bits 16-23]", "// a 16-bit Entry index [bits 0-...
Get resources match the given resource id.
[ "Get", "resources", "match", "the", "given", "resource", "id", "." ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/struct/resource/ResourceTable.java#L41-L88
112,782
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/parser/ResourceTableParser.java
ResourceTableParser.parse
public void parse() { // read resource file header. ResourceTableHeader resourceTableHeader = (ResourceTableHeader) readChunkHeader(); // read string pool chunk stringPool = ParseUtils.readStringPool(buffer, (StringPoolHeader) readChunkHeader()); resourceTable = new ResourceTab...
java
public void parse() { // read resource file header. ResourceTableHeader resourceTableHeader = (ResourceTableHeader) readChunkHeader(); // read string pool chunk stringPool = ParseUtils.readStringPool(buffer, (StringPoolHeader) readChunkHeader()); resourceTable = new ResourceTab...
[ "public", "void", "parse", "(", ")", "{", "// read resource file header.", "ResourceTableHeader", "resourceTableHeader", "=", "(", "ResourceTableHeader", ")", "readChunkHeader", "(", ")", ";", "// read string pool chunk", "stringPool", "=", "ParseUtils", ".", "readStringP...
parse resource table file.
[ "parse", "resource", "table", "file", "." ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/parser/ResourceTableParser.java#L48-L64
112,783
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/utils/ResourceLoader.java
ResourceLoader.loadSystemAttrIds
public static Map<Integer, String> loadSystemAttrIds() { try (BufferedReader reader = toReader("/r_values.ini")) { Map<Integer, String> map = new HashMap<>(); String line; while ((line = reader.readLine()) != null) { String[] items = line.trim().split("="); ...
java
public static Map<Integer, String> loadSystemAttrIds() { try (BufferedReader reader = toReader("/r_values.ini")) { Map<Integer, String> map = new HashMap<>(); String line; while ((line = reader.readLine()) != null) { String[] items = line.trim().split("="); ...
[ "public", "static", "Map", "<", "Integer", ",", "String", ">", "loadSystemAttrIds", "(", ")", "{", "try", "(", "BufferedReader", "reader", "=", "toReader", "(", "\"/r_values.ini\"", ")", ")", "{", "Map", "<", "Integer", ",", "String", ">", "map", "=", "n...
load system attr ids for parse binary xml.
[ "load", "system", "attr", "ids", "for", "parse", "binary", "xml", "." ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/utils/ResourceLoader.java#L20-L37
112,784
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/utils/ParseUtils.java
ParseUtils.readString
public static String readString(ByteBuffer buffer, boolean utf8) { if (utf8) { // The lengths are encoded in the same way as for the 16-bit format // but using 8-bit rather than 16-bit integers. int strLen = readLen(buffer); int bytesLen = readLen(buffer); ...
java
public static String readString(ByteBuffer buffer, boolean utf8) { if (utf8) { // The lengths are encoded in the same way as for the 16-bit format // but using 8-bit rather than 16-bit integers. int strLen = readLen(buffer); int bytesLen = readLen(buffer); ...
[ "public", "static", "String", "readString", "(", "ByteBuffer", "buffer", ",", "boolean", "utf8", ")", "{", "if", "(", "utf8", ")", "{", "// The lengths are encoded in the same way as for the 16-bit format", "// but using 8-bit rather than 16-bit integers.", "int", "strLen", ...
read string from input buffer. if get EOF before read enough data, throw IOException.
[ "read", "string", "from", "input", "buffer", ".", "if", "get", "EOF", "before", "read", "enough", "data", "throw", "IOException", "." ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/utils/ParseUtils.java#L24-L43
112,785
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/utils/ParseUtils.java
ParseUtils.readStringUTF16
public static String readStringUTF16(ByteBuffer buffer, int strLen) { String str = Buffers.readString(buffer, strLen); for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c == 0) { return str.substring(0, i); } } return...
java
public static String readStringUTF16(ByteBuffer buffer, int strLen) { String str = Buffers.readString(buffer, strLen); for (int i = 0; i < str.length(); i++) { char c = str.charAt(i); if (c == 0) { return str.substring(0, i); } } return...
[ "public", "static", "String", "readStringUTF16", "(", "ByteBuffer", "buffer", ",", "int", "strLen", ")", "{", "String", "str", "=", "Buffers", ".", "readString", "(", "buffer", ",", "strLen", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", ...
read utf-16 encoding str, use zero char to end str.
[ "read", "utf", "-", "16", "encoding", "str", "use", "zero", "char", "to", "end", "str", "." ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/utils/ParseUtils.java#L48-L57
112,786
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/utils/ParseUtils.java
ParseUtils.readLen
private static int readLen(ByteBuffer buffer) { int len = 0; int i = Buffers.readUByte(buffer); if ((i & 0x80) != 0) { //read one more byte. len |= (i & 0x7f) << 8; len += Buffers.readUByte(buffer); } else { len = i; } retur...
java
private static int readLen(ByteBuffer buffer) { int len = 0; int i = Buffers.readUByte(buffer); if ((i & 0x80) != 0) { //read one more byte. len |= (i & 0x7f) << 8; len += Buffers.readUByte(buffer); } else { len = i; } retur...
[ "private", "static", "int", "readLen", "(", "ByteBuffer", "buffer", ")", "{", "int", "len", "=", "0", ";", "int", "i", "=", "Buffers", ".", "readUByte", "(", "buffer", ")", ";", "if", "(", "(", "i", "&", "0x80", ")", "!=", "0", ")", "{", "//read ...
read encoding len. see StringPool.cpp ENCODE_LENGTH
[ "read", "encoding", "len", ".", "see", "StringPool", ".", "cpp", "ENCODE_LENGTH" ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/utils/ParseUtils.java#L63-L74
112,787
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/utils/ParseUtils.java
ParseUtils.readLen16
private static int readLen16(ByteBuffer buffer) { int len = 0; int i = Buffers.readUShort(buffer); if ((i & 0x8000) != 0) { len |= (i & 0x7fff) << 16; len += Buffers.readUShort(buffer); } else { len = i; } return len; }
java
private static int readLen16(ByteBuffer buffer) { int len = 0; int i = Buffers.readUShort(buffer); if ((i & 0x8000) != 0) { len |= (i & 0x7fff) << 16; len += Buffers.readUShort(buffer); } else { len = i; } return len; }
[ "private", "static", "int", "readLen16", "(", "ByteBuffer", "buffer", ")", "{", "int", "len", "=", "0", ";", "int", "i", "=", "Buffers", ".", "readUShort", "(", "buffer", ")", ";", "if", "(", "(", "i", "&", "0x8000", ")", "!=", "0", ")", "{", "le...
read encoding len. see Stringpool.cpp ENCODE_LENGTH
[ "read", "encoding", "len", ".", "see", "Stringpool", ".", "cpp", "ENCODE_LENGTH" ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/utils/ParseUtils.java#L80-L90
112,788
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/utils/ParseUtils.java
ParseUtils.readStringPool
public static StringPool readStringPool(ByteBuffer buffer, StringPoolHeader stringPoolHeader) { long beginPos = buffer.position(); int[] offsets = new int[stringPoolHeader.getStringCount()]; // read strings offset if (stringPoolHeader.getStringCount() > 0) { for (int idx = 0...
java
public static StringPool readStringPool(ByteBuffer buffer, StringPoolHeader stringPoolHeader) { long beginPos = buffer.position(); int[] offsets = new int[stringPoolHeader.getStringCount()]; // read strings offset if (stringPoolHeader.getStringCount() > 0) { for (int idx = 0...
[ "public", "static", "StringPool", "readStringPool", "(", "ByteBuffer", "buffer", ",", "StringPoolHeader", "stringPoolHeader", ")", "{", "long", "beginPos", "=", "buffer", ".", "position", "(", ")", ";", "int", "[", "]", "offsets", "=", "new", "int", "[", "st...
read String pool, for apk binary xml file and resource table.
[ "read", "String", "pool", "for", "apk", "binary", "xml", "file", "and", "resource", "table", "." ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/utils/ParseUtils.java#L96-L145
112,789
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/utils/ParseUtils.java
ParseUtils.readResValue
@Nullable public static ResourceValue readResValue(ByteBuffer buffer, StringPool stringPool) { // ResValue resValue = new ResValue(); int size = Buffers.readUShort(buffer); short res0 = Buffers.readUByte(buffer); short dataType = Buffers.readUByte(buffer); switch (dataType) {...
java
@Nullable public static ResourceValue readResValue(ByteBuffer buffer, StringPool stringPool) { // ResValue resValue = new ResValue(); int size = Buffers.readUShort(buffer); short res0 = Buffers.readUByte(buffer); short dataType = Buffers.readUByte(buffer); switch (dataType) {...
[ "@", "Nullable", "public", "static", "ResourceValue", "readResValue", "(", "ByteBuffer", "buffer", ",", "StringPool", "stringPool", ")", "{", "// ResValue resValue = new ResValue();", "int", "size", "=", "Buffers", ".", "readUShort", "(", "buffer", ")", ";", ...
read res value, convert from different types to string.
[ "read", "res", "value", "convert", "from", "different", "types", "to", "string", "." ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/utils/ParseUtils.java#L150-L188
112,790
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/parser/BCCertificateParser.java
BCCertificateParser.parse
@SuppressWarnings("unchecked") public List<CertificateMeta> parse() throws CertificateException { CMSSignedData cmsSignedData; try { cmsSignedData = new CMSSignedData(data); } catch (CMSException e) { throw new CertificateException(e); } Store<X509Cert...
java
@SuppressWarnings("unchecked") public List<CertificateMeta> parse() throws CertificateException { CMSSignedData cmsSignedData; try { cmsSignedData = new CMSSignedData(data); } catch (CMSException e) { throw new CertificateException(e); } Store<X509Cert...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "List", "<", "CertificateMeta", ">", "parse", "(", ")", "throws", "CertificateException", "{", "CMSSignedData", "cmsSignedData", ";", "try", "{", "cmsSignedData", "=", "new", "CMSSignedData", "(", "data...
get certificate info
[ "get", "certificate", "info" ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/parser/BCCertificateParser.java#L36-L55
112,791
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/utils/Locales.java
Locales.match
public static int match(Locale locale, Locale targetLocale) { if (locale == null) { return -1; } if (locale.getLanguage().equals(targetLocale.getLanguage())) { if (locale.getCountry().equals(targetLocale.getCountry())) { return 3; } else if (ta...
java
public static int match(Locale locale, Locale targetLocale) { if (locale == null) { return -1; } if (locale.getLanguage().equals(targetLocale.getLanguage())) { if (locale.getCountry().equals(targetLocale.getCountry())) { return 3; } else if (ta...
[ "public", "static", "int", "match", "(", "Locale", "locale", ",", "Locale", "targetLocale", ")", "{", "if", "(", "locale", "==", "null", ")", "{", "return", "-", "1", ";", "}", "if", "(", "locale", ".", "getLanguage", "(", ")", ".", "equals", "(", ...
How much the given locale match the expected locale.
[ "How", "much", "the", "given", "locale", "match", "the", "expected", "locale", "." ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/utils/Locales.java#L18-L35
112,792
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/struct/resource/ResourceMapEntry.java
ResourceMapEntry.toStringValue
public String toStringValue(ResourceTable resourceTable, Locale locale) { if (resourceTableMaps.length > 0) { return resourceTableMaps[0].toString(); } else { return null; } }
java
public String toStringValue(ResourceTable resourceTable, Locale locale) { if (resourceTableMaps.length > 0) { return resourceTableMaps[0].toString(); } else { return null; } }
[ "public", "String", "toStringValue", "(", "ResourceTable", "resourceTable", ",", "Locale", "locale", ")", "{", "if", "(", "resourceTableMaps", ".", "length", ">", "0", ")", "{", "return", "resourceTableMaps", "[", "0", "]", ".", "toString", "(", ")", ";", ...
get value as string @return
[ "get", "value", "as", "string" ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/struct/resource/ResourceMapEntry.java#L55-L61
112,793
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/utils/xml/CharSequenceTranslator.java
CharSequenceTranslator.with
public final CharSequenceTranslator with(final CharSequenceTranslator... translators) { final CharSequenceTranslator[] newArray = new CharSequenceTranslator[translators.length + 1]; newArray[0] = this; System.arraycopy(translators, 0, newArray, 1, translators.length); return new Aggregat...
java
public final CharSequenceTranslator with(final CharSequenceTranslator... translators) { final CharSequenceTranslator[] newArray = new CharSequenceTranslator[translators.length + 1]; newArray[0] = this; System.arraycopy(translators, 0, newArray, 1, translators.length); return new Aggregat...
[ "public", "final", "CharSequenceTranslator", "with", "(", "final", "CharSequenceTranslator", "...", "translators", ")", "{", "final", "CharSequenceTranslator", "[", "]", "newArray", "=", "new", "CharSequenceTranslator", "[", "translators", ".", "length", "+", "1", "...
Helper method to create a merger of this translator with another set of translators. Useful in customizing the standard functionality. @param translators CharSequenceTranslator array of translators to merge with this one @return CharSequenceTranslator merging this translator with the others
[ "Helper", "method", "to", "create", "a", "merger", "of", "this", "translator", "with", "another", "set", "of", "translators", ".", "Useful", "in", "customizing", "the", "standard", "functionality", "." ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/utils/xml/CharSequenceTranslator.java#L105-L110
112,794
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/parser/DexParser.java
DexParser.readClass
private DexClassStruct[] readClass(long classDefsOff, int classDefsSize) { Buffers.position(buffer, classDefsOff); DexClassStruct[] dexClassStructs = new DexClassStruct[classDefsSize]; for (int i = 0; i < classDefsSize; i++) { DexClassStruct dexClassStruct = new DexClassStruct(); ...
java
private DexClassStruct[] readClass(long classDefsOff, int classDefsSize) { Buffers.position(buffer, classDefsOff); DexClassStruct[] dexClassStructs = new DexClassStruct[classDefsSize]; for (int i = 0; i < classDefsSize; i++) { DexClassStruct dexClassStruct = new DexClassStruct(); ...
[ "private", "DexClassStruct", "[", "]", "readClass", "(", "long", "classDefsOff", ",", "int", "classDefsSize", ")", "{", "Buffers", ".", "position", "(", "buffer", ",", "classDefsOff", ")", ";", "DexClassStruct", "[", "]", "dexClassStructs", "=", "new", "DexCla...
read class info.
[ "read", "class", "info", "." ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/parser/DexParser.java#L87-L107
112,795
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/parser/DexParser.java
DexParser.readTypes
private int[] readTypes(long typeIdsOff, int typeIdsSize) { Buffers.position(buffer, typeIdsOff); int[] typeIds = new int[typeIdsSize]; for (int i = 0; i < typeIdsSize; i++) { typeIds[i] = (int) Buffers.readUInt(buffer); } return typeIds; }
java
private int[] readTypes(long typeIdsOff, int typeIdsSize) { Buffers.position(buffer, typeIdsOff); int[] typeIds = new int[typeIdsSize]; for (int i = 0; i < typeIdsSize; i++) { typeIds[i] = (int) Buffers.readUInt(buffer); } return typeIds; }
[ "private", "int", "[", "]", "readTypes", "(", "long", "typeIdsOff", ",", "int", "typeIdsSize", ")", "{", "Buffers", ".", "position", "(", "buffer", ",", "typeIdsOff", ")", ";", "int", "[", "]", "typeIds", "=", "new", "int", "[", "typeIdsSize", "]", ";"...
read types.
[ "read", "types", "." ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/parser/DexParser.java#L112-L119
112,796
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/parser/DexParser.java
DexParser.readStrings
private StringPool readStrings(long[] offsets) { // read strings. // buffer some apk, the strings' offsets may not well ordered. we sort it first StringPoolEntry[] entries = new StringPoolEntry[offsets.length]; for (int i = 0; i < offsets.length; i++) { entries[i] = new Stri...
java
private StringPool readStrings(long[] offsets) { // read strings. // buffer some apk, the strings' offsets may not well ordered. we sort it first StringPoolEntry[] entries = new StringPoolEntry[offsets.length]; for (int i = 0; i < offsets.length; i++) { entries[i] = new Stri...
[ "private", "StringPool", "readStrings", "(", "long", "[", "]", "offsets", ")", "{", "// read strings.", "// buffer some apk, the strings' offsets may not well ordered. we sort it first", "StringPoolEntry", "[", "]", "entries", "=", "new", "StringPoolEntry", "[", "offsets", ...
read string pool for dex file. dex file string pool diff a bit with binary xml file or resource table. @param offsets @return @throws IOException
[ "read", "string", "pool", "for", "dex", "file", ".", "dex", "file", "string", "pool", "diff", "a", "bit", "with", "binary", "xml", "file", "or", "resource", "table", "." ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/parser/DexParser.java#L129-L153
112,797
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/parser/DexParser.java
DexParser.readString
private String readString(int strLen) { char[] chars = new char[strLen]; for (int i = 0; i < strLen; i++) { short a = Buffers.readUByte(buffer); if ((a & 0x80) == 0) { // ascii char chars[i] = (char) a; } else if ((a & 0xe0) == 0xc0) {...
java
private String readString(int strLen) { char[] chars = new char[strLen]; for (int i = 0; i < strLen; i++) { short a = Buffers.readUByte(buffer); if ((a & 0x80) == 0) { // ascii char chars[i] = (char) a; } else if ((a & 0xe0) == 0xc0) {...
[ "private", "String", "readString", "(", "int", "strLen", ")", "{", "char", "[", "]", "chars", "=", "new", "char", "[", "strLen", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "strLen", ";", "i", "++", ")", "{", "short", "a", "=", ...
read Modified UTF-8 encoding str. @param strLen the java-utf16-char len, not strLen nor bytes len.
[ "read", "Modified", "UTF", "-", "8", "encoding", "str", "." ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/parser/DexParser.java#L182-L210
112,798
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/parser/DexParser.java
DexParser.readVarInts
private int readVarInts() { int i = 0; int count = 0; short s; do { if (count > 4) { throw new ParserException("read varints error."); } s = Buffers.readUByte(buffer); i |= (s & 0x7f) << (count * 7); count++; ...
java
private int readVarInts() { int i = 0; int count = 0; short s; do { if (count > 4) { throw new ParserException("read varints error."); } s = Buffers.readUByte(buffer); i |= (s & 0x7f) << (count * 7); count++; ...
[ "private", "int", "readVarInts", "(", ")", "{", "int", "i", "=", "0", ";", "int", "count", "=", "0", ";", "short", "s", ";", "do", "{", "if", "(", "count", ">", "4", ")", "{", "throw", "new", "ParserException", "(", "\"read varints error.\"", ")", ...
read varints. @return @throws IOException
[ "read", "varints", "." ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/parser/DexParser.java#L219-L233
112,799
hsiafan/apk-parser
src/main/java/net/dongliu/apk/parser/AbstractApkFile.java
AbstractApkFile.getCertificateMetaList
@Deprecated public List<CertificateMeta> getCertificateMetaList() throws IOException, CertificateException { if (apkSigners == null) { parseCertificates(); } if (apkSigners.isEmpty()) { throw new ParserException("ApkFile certificate not found"); } retu...
java
@Deprecated public List<CertificateMeta> getCertificateMetaList() throws IOException, CertificateException { if (apkSigners == null) { parseCertificates(); } if (apkSigners.isEmpty()) { throw new ParserException("ApkFile certificate not found"); } retu...
[ "@", "Deprecated", "public", "List", "<", "CertificateMeta", ">", "getCertificateMetaList", "(", ")", "throws", "IOException", ",", "CertificateException", "{", "if", "(", "apkSigners", "==", "null", ")", "{", "parseCertificates", "(", ")", ";", "}", "if", "("...
Get the apk's certificate meta. If have multi signer, return the certificate the first signer used. @deprecated use {{@link #getApkSingers()}} instead
[ "Get", "the", "apk", "s", "certificate", "meta", ".", "If", "have", "multi", "signer", "return", "the", "certificate", "the", "first", "signer", "used", "." ]
8993ddd52017b37b8f2e784ae0a15417d9ede932
https://github.com/hsiafan/apk-parser/blob/8993ddd52017b37b8f2e784ae0a15417d9ede932/src/main/java/net/dongliu/apk/parser/AbstractApkFile.java#L89-L98