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
47,800
Twitter4J/Twitter4J
twitter4j-core/src/main/java/twitter4j/TwitterBaseImpl.java
TwitterBaseImpl.setOAuthConsumer
@Override public synchronized void setOAuthConsumer(String consumerKey, String consumerSecret) { if (null == consumerKey) { throw new NullPointerException("consumer key is null"); } if (null == consumerSecret) { throw new NullPointerException("consumer secret is null"...
java
@Override public synchronized void setOAuthConsumer(String consumerKey, String consumerSecret) { if (null == consumerKey) { throw new NullPointerException("consumer key is null"); } if (null == consumerSecret) { throw new NullPointerException("consumer secret is null"...
[ "@", "Override", "public", "synchronized", "void", "setOAuthConsumer", "(", "String", "consumerKey", ",", "String", "consumerSecret", ")", "{", "if", "(", "null", "==", "consumerKey", ")", "{", "throw", "new", "NullPointerException", "(", "\"consumer key is null\"",...
methods declared in OAuthSupport interface
[ "methods", "declared", "in", "OAuthSupport", "interface" ]
8376fade8d557896bb9319fb46e39a55b134b166
https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/TwitterBaseImpl.java#L262-L287
47,801
grantland/android-autofittextview
library/src/main/java/me/grantland/widget/AutofitHelper.java
AutofitHelper.autofit
private static void autofit(TextView view, TextPaint paint, float minTextSize, float maxTextSize, int maxLines, float precision) { if (maxLines <= 0 || maxLines == Integer.MAX_VALUE) { // Don't auto-size since there's no limit on lines. return; } int targetWi...
java
private static void autofit(TextView view, TextPaint paint, float minTextSize, float maxTextSize, int maxLines, float precision) { if (maxLines <= 0 || maxLines == Integer.MAX_VALUE) { // Don't auto-size since there's no limit on lines. return; } int targetWi...
[ "private", "static", "void", "autofit", "(", "TextView", "view", ",", "TextPaint", "paint", ",", "float", "minTextSize", ",", "float", "maxTextSize", ",", "int", "maxLines", ",", "float", "precision", ")", "{", "if", "(", "maxLines", "<=", "0", "||", "maxL...
Re-sizes the textSize of the TextView so that the text fits within the bounds of the View.
[ "Re", "-", "sizes", "the", "textSize", "of", "the", "TextView", "so", "that", "the", "text", "fits", "within", "the", "bounds", "of", "the", "View", "." ]
5c565aa5c3ed62aaa31140440bb526e7435e7947
https://github.com/grantland/android-autofittextview/blob/5c565aa5c3ed62aaa31140440bb526e7435e7947/library/src/main/java/me/grantland/widget/AutofitHelper.java#L91-L136
47,802
grantland/android-autofittextview
library/src/main/java/me/grantland/widget/AutofitHelper.java
AutofitHelper.getAutofitTextSize
private static float getAutofitTextSize(CharSequence text, TextPaint paint, float targetWidth, int maxLines, float low, float high, float precision, DisplayMetrics displayMetrics) { float mid = (low + high) / 2.0f; int lineCount = 1; StaticLayout layout = null; p...
java
private static float getAutofitTextSize(CharSequence text, TextPaint paint, float targetWidth, int maxLines, float low, float high, float precision, DisplayMetrics displayMetrics) { float mid = (low + high) / 2.0f; int lineCount = 1; StaticLayout layout = null; p...
[ "private", "static", "float", "getAutofitTextSize", "(", "CharSequence", "text", ",", "TextPaint", "paint", ",", "float", "targetWidth", ",", "int", "maxLines", ",", "float", "low", ",", "float", "high", ",", "float", "precision", ",", "DisplayMetrics", "display...
Recursive binary search to find the best size for the text.
[ "Recursive", "binary", "search", "to", "find", "the", "best", "size", "for", "the", "text", "." ]
5c565aa5c3ed62aaa31140440bb526e7435e7947
https://github.com/grantland/android-autofittextview/blob/5c565aa5c3ed62aaa31140440bb526e7435e7947/library/src/main/java/me/grantland/widget/AutofitHelper.java#L141-L196
47,803
grantland/android-autofittextview
library/src/main/java/me/grantland/widget/AutofitHelper.java
AutofitHelper.setMinTextSize
public AutofitHelper setMinTextSize(int unit, float size) { Context context = mTextView.getContext(); Resources r = Resources.getSystem(); if (context != null) { r = context.getResources(); } setRawMinTextSize(TypedValue.applyDimension(unit, size, r.getDisplayMetric...
java
public AutofitHelper setMinTextSize(int unit, float size) { Context context = mTextView.getContext(); Resources r = Resources.getSystem(); if (context != null) { r = context.getResources(); } setRawMinTextSize(TypedValue.applyDimension(unit, size, r.getDisplayMetric...
[ "public", "AutofitHelper", "setMinTextSize", "(", "int", "unit", ",", "float", "size", ")", "{", "Context", "context", "=", "mTextView", ".", "getContext", "(", ")", ";", "Resources", "r", "=", "Resources", ".", "getSystem", "(", ")", ";", "if", "(", "co...
Set the minimum text size to a given unit and value. See TypedValue for the possible dimension units. @param unit The desired dimension unit. @param size The desired size in the given units. @attr ref me.grantland.R.styleable#AutofitTextView_minTextSize
[ "Set", "the", "minimum", "text", "size", "to", "a", "given", "unit", "and", "value", ".", "See", "TypedValue", "for", "the", "possible", "dimension", "units", "." ]
5c565aa5c3ed62aaa31140440bb526e7435e7947
https://github.com/grantland/android-autofittextview/blob/5c565aa5c3ed62aaa31140440bb526e7435e7947/library/src/main/java/me/grantland/widget/AutofitHelper.java#L333-L343
47,804
grantland/android-autofittextview
library/src/main/java/me/grantland/widget/AutofitHelper.java
AutofitHelper.setMaxTextSize
public AutofitHelper setMaxTextSize(int unit, float size) { Context context = mTextView.getContext(); Resources r = Resources.getSystem(); if (context != null) { r = context.getResources(); } setRawMaxTextSize(TypedValue.applyDimension(unit, size, r.getDisplayMetric...
java
public AutofitHelper setMaxTextSize(int unit, float size) { Context context = mTextView.getContext(); Resources r = Resources.getSystem(); if (context != null) { r = context.getResources(); } setRawMaxTextSize(TypedValue.applyDimension(unit, size, r.getDisplayMetric...
[ "public", "AutofitHelper", "setMaxTextSize", "(", "int", "unit", ",", "float", "size", ")", "{", "Context", "context", "=", "mTextView", ".", "getContext", "(", ")", ";", "Resources", "r", "=", "Resources", ".", "getSystem", "(", ")", ";", "if", "(", "co...
Set the maximum text size to a given unit and value. See TypedValue for the possible dimension units. @param unit The desired dimension unit. @param size The desired size in the given units. @attr ref android.R.styleable#TextView_textSize
[ "Set", "the", "maximum", "text", "size", "to", "a", "given", "unit", "and", "value", ".", "See", "TypedValue", "for", "the", "possible", "dimension", "units", "." ]
5c565aa5c3ed62aaa31140440bb526e7435e7947
https://github.com/grantland/android-autofittextview/blob/5c565aa5c3ed62aaa31140440bb526e7435e7947/library/src/main/java/me/grantland/widget/AutofitHelper.java#L381-L391
47,805
grantland/android-autofittextview
library/src/main/java/me/grantland/widget/AutofitHelper.java
AutofitHelper.setEnabled
public AutofitHelper setEnabled(boolean enabled) { if (mEnabled != enabled) { mEnabled = enabled; if (enabled) { mTextView.addTextChangedListener(mTextWatcher); mTextView.addOnLayoutChangeListener(mOnLayoutChangeListener); autofit(); ...
java
public AutofitHelper setEnabled(boolean enabled) { if (mEnabled != enabled) { mEnabled = enabled; if (enabled) { mTextView.addTextChangedListener(mTextWatcher); mTextView.addOnLayoutChangeListener(mOnLayoutChangeListener); autofit(); ...
[ "public", "AutofitHelper", "setEnabled", "(", "boolean", "enabled", ")", "{", "if", "(", "mEnabled", "!=", "enabled", ")", "{", "mEnabled", "=", "enabled", ";", "if", "(", "enabled", ")", "{", "mTextView", ".", "addTextChangedListener", "(", "mTextWatcher", ...
Set the enabled state of automatically resizing text.
[ "Set", "the", "enabled", "state", "of", "automatically", "resizing", "text", "." ]
5c565aa5c3ed62aaa31140440bb526e7435e7947
https://github.com/grantland/android-autofittextview/blob/5c565aa5c3ed62aaa31140440bb526e7435e7947/library/src/main/java/me/grantland/widget/AutofitHelper.java#L430-L447
47,806
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java
ReflectionUtils.getDeclaredFields
public static <T> List<Field> getDeclaredFields(T type) { return new ArrayList<>(asList(type.getClass().getDeclaredFields())); }
java
public static <T> List<Field> getDeclaredFields(T type) { return new ArrayList<>(asList(type.getClass().getDeclaredFields())); }
[ "public", "static", "<", "T", ">", "List", "<", "Field", ">", "getDeclaredFields", "(", "T", "type", ")", "{", "return", "new", "ArrayList", "<>", "(", "asList", "(", "type", ".", "getClass", "(", ")", ".", "getDeclaredFields", "(", ")", ")", ")", ";...
Get declared fields of a given type. @param type the type to introspect @param <T> the actual type to introspect @return list of declared fields
[ "Get", "declared", "fields", "of", "a", "given", "type", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java#L102-L104
47,807
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java
ReflectionUtils.getInheritedFields
public static List<Field> getInheritedFields(Class<?> type) { List<Field> inheritedFields = new ArrayList<>(); while (type.getSuperclass() != null) { Class<?> superclass = type.getSuperclass(); inheritedFields.addAll(asList(superclass.getDeclaredFields())); type = sup...
java
public static List<Field> getInheritedFields(Class<?> type) { List<Field> inheritedFields = new ArrayList<>(); while (type.getSuperclass() != null) { Class<?> superclass = type.getSuperclass(); inheritedFields.addAll(asList(superclass.getDeclaredFields())); type = sup...
[ "public", "static", "List", "<", "Field", ">", "getInheritedFields", "(", "Class", "<", "?", ">", "type", ")", "{", "List", "<", "Field", ">", "inheritedFields", "=", "new", "ArrayList", "<>", "(", ")", ";", "while", "(", "type", ".", "getSuperclass", ...
Get inherited fields of a given type. @param type the type to introspect @return list of inherited fields
[ "Get", "inherited", "fields", "of", "a", "given", "type", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java#L112-L120
47,808
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java
ReflectionUtils.getWrapperType
public Class<?> getWrapperType(Class<?> primitiveType) { for(PrimitiveEnum p : PrimitiveEnum.values()) { if(p.getType().equals(primitiveType)) { return p.getClazz(); } } return primitiveType; // if not primitive, return it as is }
java
public Class<?> getWrapperType(Class<?> primitiveType) { for(PrimitiveEnum p : PrimitiveEnum.values()) { if(p.getType().equals(primitiveType)) { return p.getClazz(); } } return primitiveType; // if not primitive, return it as is }
[ "public", "Class", "<", "?", ">", "getWrapperType", "(", "Class", "<", "?", ">", "primitiveType", ")", "{", "for", "(", "PrimitiveEnum", "p", ":", "PrimitiveEnum", ".", "values", "(", ")", ")", "{", "if", "(", "p", ".", "getType", "(", ")", ".", "e...
Get wrapper type of a primitive type. @param primitiveType to get its wrapper type @return the wrapper type of the given primitive type
[ "Get", "wrapper", "type", "of", "a", "primitive", "type", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java#L159-L167
47,809
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java
ReflectionUtils.isPrimitiveFieldWithDefaultValue
public static boolean isPrimitiveFieldWithDefaultValue(final Object object, final Field field) throws IllegalAccessException { Class<?> fieldType = field.getType(); if (!fieldType.isPrimitive()) { return false; } Object fieldValue = getFieldValue(object, field); if (f...
java
public static boolean isPrimitiveFieldWithDefaultValue(final Object object, final Field field) throws IllegalAccessException { Class<?> fieldType = field.getType(); if (!fieldType.isPrimitive()) { return false; } Object fieldValue = getFieldValue(object, field); if (f...
[ "public", "static", "boolean", "isPrimitiveFieldWithDefaultValue", "(", "final", "Object", "object", ",", "final", "Field", "field", ")", "throws", "IllegalAccessException", "{", "Class", "<", "?", ">", "fieldType", "=", "field", ".", "getType", "(", ")", ";", ...
Check if a field has a primitive type and matching default value which is set by the compiler. @param object instance to get the field value of @param field field to check @return true if the field is primitive and is set to the default value, false otherwise @throws IllegalAccessException if field cannot be accessed
[ "Check", "if", "a", "field", "has", "a", "primitive", "type", "and", "matching", "default", "value", "which", "is", "set", "by", "the", "compiler", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java#L177-L211
47,810
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java
ReflectionUtils.isCollectionType
public static boolean isCollectionType(final Type type) { return isParameterizedType(type) && isCollectionType((Class<?>) ((ParameterizedType) type).getRawType()); }
java
public static boolean isCollectionType(final Type type) { return isParameterizedType(type) && isCollectionType((Class<?>) ((ParameterizedType) type).getRawType()); }
[ "public", "static", "boolean", "isCollectionType", "(", "final", "Type", "type", ")", "{", "return", "isParameterizedType", "(", "type", ")", "&&", "isCollectionType", "(", "(", "Class", "<", "?", ">", ")", "(", "(", "ParameterizedType", ")", "type", ")", ...
Check if a type is a collection type. @param type the type to check. @return true if the type is a collection type, false otherwise
[ "Check", "if", "a", "type", "is", "a", "collection", "type", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java#L291-L293
47,811
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java
ReflectionUtils.isPopulatable
public static boolean isPopulatable(final Type type) { return !isWildcardType(type) && !isTypeVariable(type) && !isCollectionType(type) && !isParameterizedType(type); }
java
public static boolean isPopulatable(final Type type) { return !isWildcardType(type) && !isTypeVariable(type) && !isCollectionType(type) && !isParameterizedType(type); }
[ "public", "static", "boolean", "isPopulatable", "(", "final", "Type", "type", ")", "{", "return", "!", "isWildcardType", "(", "type", ")", "&&", "!", "isTypeVariable", "(", "type", ")", "&&", "!", "isCollectionType", "(", "type", ")", "&&", "!", "isParamet...
Check if a type is populatable. @param type the type to check @return true if the type is populatable, false otherwise
[ "Check", "if", "a", "type", "is", "populatable", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java#L301-L303
47,812
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java
ReflectionUtils.isIntrospectable
public static boolean isIntrospectable(final Class<?> type) { return !isEnumType(type) && !isArrayType(type) && !(isCollectionType(type) && isJdkBuiltIn(type)) && !(isMapType(type) && isJdkBuiltIn(type)); }
java
public static boolean isIntrospectable(final Class<?> type) { return !isEnumType(type) && !isArrayType(type) && !(isCollectionType(type) && isJdkBuiltIn(type)) && !(isMapType(type) && isJdkBuiltIn(type)); }
[ "public", "static", "boolean", "isIntrospectable", "(", "final", "Class", "<", "?", ">", "type", ")", "{", "return", "!", "isEnumType", "(", "type", ")", "&&", "!", "isArrayType", "(", "type", ")", "&&", "!", "(", "isCollectionType", "(", "type", ")", ...
Check if a type should be introspected for internal fields. @param type the type to check @return true if the type should be introspected, false otherwise
[ "Check", "if", "a", "type", "should", "be", "introspected", "for", "internal", "fields", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java#L311-L316
47,813
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java
ReflectionUtils.isParameterizedType
public static boolean isParameterizedType(final Type type) { return type != null && type instanceof ParameterizedType && ((ParameterizedType) type).getActualTypeArguments().length > 0; }
java
public static boolean isParameterizedType(final Type type) { return type != null && type instanceof ParameterizedType && ((ParameterizedType) type).getActualTypeArguments().length > 0; }
[ "public", "static", "boolean", "isParameterizedType", "(", "final", "Type", "type", ")", "{", "return", "type", "!=", "null", "&&", "type", "instanceof", "ParameterizedType", "&&", "(", "(", "ParameterizedType", ")", "type", ")", ".", "getActualTypeArguments", "...
Check if a type is a parameterized type @param type the type to check @return true if the type is parameterized, false otherwise
[ "Check", "if", "a", "type", "is", "a", "parameterized", "type" ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java#L344-L346
47,814
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java
ReflectionUtils.filterSameParameterizedTypes
public static List<Class<?>> filterSameParameterizedTypes(final List<Class<?>> types, final Type type) { if (type instanceof ParameterizedType) { Type[] fieldArugmentTypes = ((ParameterizedType) type).getActualTypeArguments(); List<Class<?>> typesWithSameParameterizedTypes = new ArrayLis...
java
public static List<Class<?>> filterSameParameterizedTypes(final List<Class<?>> types, final Type type) { if (type instanceof ParameterizedType) { Type[] fieldArugmentTypes = ((ParameterizedType) type).getActualTypeArguments(); List<Class<?>> typesWithSameParameterizedTypes = new ArrayLis...
[ "public", "static", "List", "<", "Class", "<", "?", ">", ">", "filterSameParameterizedTypes", "(", "final", "List", "<", "Class", "<", "?", ">", ">", "types", ",", "final", "Type", "type", ")", "{", "if", "(", "type", "instanceof", "ParameterizedType", "...
Filters a list of types to keep only elements having the same parameterized types as the given type. @param type the type to use for the search @param types a list of types to filter @return a list of types having the same parameterized types as the given type
[ "Filters", "a", "list", "of", "types", "to", "keep", "only", "elements", "having", "the", "same", "parameterized", "types", "as", "the", "given", "type", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java#L386-L397
47,815
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java
ReflectionUtils.getAnnotation
public static <T extends Annotation> T getAnnotation(Field field, Class<T> annotationType) { return field.getAnnotation(annotationType) == null ? getAnnotationFromReadMethod(getReadMethod(field).orElse(null), annotationType) : field.getAnnotation(annotationType); }
java
public static <T extends Annotation> T getAnnotation(Field field, Class<T> annotationType) { return field.getAnnotation(annotationType) == null ? getAnnotationFromReadMethod(getReadMethod(field).orElse(null), annotationType) : field.getAnnotation(annotationType); }
[ "public", "static", "<", "T", "extends", "Annotation", ">", "T", "getAnnotation", "(", "Field", "field", ",", "Class", "<", "T", ">", "annotationType", ")", "{", "return", "field", ".", "getAnnotation", "(", "annotationType", ")", "==", "null", "?", "getAn...
Looks for given annotationType on given field or read method for field. @param field field to check @param annotationType Type of annotation you're looking for. @param <T> the actual type of annotation @return given annotation if field or read method has this annotation or null.
[ "Looks", "for", "given", "annotationType", "on", "given", "field", "or", "read", "method", "for", "field", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java#L407-L410
47,816
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java
ReflectionUtils.isAnnotationPresent
public static boolean isAnnotationPresent(Field field, Class<? extends Annotation> annotationType) { final Optional<Method> readMethod = getReadMethod(field); return field.isAnnotationPresent(annotationType) || readMethod.isPresent() && readMethod.get().isAnnotationPresent(annotationType); }
java
public static boolean isAnnotationPresent(Field field, Class<? extends Annotation> annotationType) { final Optional<Method> readMethod = getReadMethod(field); return field.isAnnotationPresent(annotationType) || readMethod.isPresent() && readMethod.get().isAnnotationPresent(annotationType); }
[ "public", "static", "boolean", "isAnnotationPresent", "(", "Field", "field", ",", "Class", "<", "?", "extends", "Annotation", ">", "annotationType", ")", "{", "final", "Optional", "<", "Method", ">", "readMethod", "=", "getReadMethod", "(", "field", ")", ";", ...
Checks if field or corresponding read method is annotated with given annotationType. @param field Field to check @param annotationType Annotation you're looking for. @return true if field or read method it annotated with given annotationType or false.
[ "Checks", "if", "field", "or", "corresponding", "read", "method", "is", "annotated", "with", "given", "annotationType", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java#L419-L422
47,817
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java
ReflectionUtils.createEmptyCollectionForType
public static Collection<?> createEmptyCollectionForType(Class<?> fieldType, int initialSize) { rejectUnsupportedTypes(fieldType); Collection<?> collection; try { collection = (Collection<?>) fieldType.newInstance(); } catch (InstantiationException | IllegalAccessException e)...
java
public static Collection<?> createEmptyCollectionForType(Class<?> fieldType, int initialSize) { rejectUnsupportedTypes(fieldType); Collection<?> collection; try { collection = (Collection<?>) fieldType.newInstance(); } catch (InstantiationException | IllegalAccessException e)...
[ "public", "static", "Collection", "<", "?", ">", "createEmptyCollectionForType", "(", "Class", "<", "?", ">", "fieldType", ",", "int", "initialSize", ")", "{", "rejectUnsupportedTypes", "(", "fieldType", ")", ";", "Collection", "<", "?", ">", "collection", ";"...
Create an empty collection for the given type. @param fieldType for which an empty collection should we created @param initialSize initial size of the collection @return empty collection
[ "Create", "an", "empty", "collection", "for", "the", "given", "type", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java#L460-L473
47,818
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java
ReflectionUtils.getReadMethod
public static Optional<Method> getReadMethod(Field field) { String fieldName = field.getName(); Class<?> fieldClass = field.getDeclaringClass(); String capitalizedFieldName = fieldName.substring(0, 1).toUpperCase(ENGLISH) + fieldName.substring(1); // try to find getProperty Optio...
java
public static Optional<Method> getReadMethod(Field field) { String fieldName = field.getName(); Class<?> fieldClass = field.getDeclaringClass(); String capitalizedFieldName = fieldName.substring(0, 1).toUpperCase(ENGLISH) + fieldName.substring(1); // try to find getProperty Optio...
[ "public", "static", "Optional", "<", "Method", ">", "getReadMethod", "(", "Field", "field", ")", "{", "String", "fieldName", "=", "field", ".", "getName", "(", ")", ";", "Class", "<", "?", ">", "fieldClass", "=", "field", ".", "getDeclaringClass", "(", "...
Get the read method for given field. @param field field to get the read method for. @return Optional of read method or empty if field has no read method
[ "Get", "the", "read", "method", "for", "given", "field", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java#L510-L521
47,819
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/randomizers/registry/AnnotationRandomizerRegistry.java
AnnotationRandomizerRegistry.getRandomizer
@Override public Randomizer<?> getRandomizer(Field field) { if (field.isAnnotationPresent(org.jeasy.random.annotation.Randomizer.class)) { org.jeasy.random.annotation.Randomizer randomizer = field.getAnnotation(org.jeasy.random.annotation.Randomizer.class); Class<?> type = randomizer...
java
@Override public Randomizer<?> getRandomizer(Field field) { if (field.isAnnotationPresent(org.jeasy.random.annotation.Randomizer.class)) { org.jeasy.random.annotation.Randomizer randomizer = field.getAnnotation(org.jeasy.random.annotation.Randomizer.class); Class<?> type = randomizer...
[ "@", "Override", "public", "Randomizer", "<", "?", ">", "getRandomizer", "(", "Field", "field", ")", "{", "if", "(", "field", ".", "isAnnotationPresent", "(", "org", ".", "jeasy", ".", "random", ".", "annotation", ".", "Randomizer", ".", "class", ")", ")...
Retrieves a randomizer for the given field. @param field the field for which a randomizer was registered @return the randomizer registered for the given field
[ "Retrieves", "a", "randomizer", "for", "the", "given", "field", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/randomizers/registry/AnnotationRandomizerRegistry.java#L54-L63
47,820
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/randomizers/AbstractRandomizer.java
AbstractRandomizer.nextDouble
protected double nextDouble(final double min, final double max) { double value = min + (random.nextDouble() * (max - min)); if (value < min) { return min; } else if (value > max) { return max; } else { return value; } // NB: ThreadLocal...
java
protected double nextDouble(final double min, final double max) { double value = min + (random.nextDouble() * (max - min)); if (value < min) { return min; } else if (value > max) { return max; } else { return value; } // NB: ThreadLocal...
[ "protected", "double", "nextDouble", "(", "final", "double", "min", ",", "final", "double", "max", ")", "{", "double", "value", "=", "min", "+", "(", "random", ".", "nextDouble", "(", ")", "*", "(", "max", "-", "min", ")", ")", ";", "if", "(", "val...
Return a random double in the given range. @param min value @param max value @return random double in the given range
[ "Return", "a", "random", "double", "in", "the", "given", "range", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/randomizers/AbstractRandomizer.java#L65-L76
47,821
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/TypePredicates.java
TypePredicates.named
public static Predicate<Class<?>> named(final String name) { return clazz -> clazz.getName().equals(name); }
java
public static Predicate<Class<?>> named(final String name) { return clazz -> clazz.getName().equals(name); }
[ "public", "static", "Predicate", "<", "Class", "<", "?", ">", ">", "named", "(", "final", "String", "name", ")", "{", "return", "clazz", "->", "clazz", ".", "getName", "(", ")", ".", "equals", "(", "name", ")", ";", "}" ]
Create a predicate to check that a type has a given name. @param name name on the type @return Predicate to check that a type has a given name.
[ "Create", "a", "predicate", "to", "check", "that", "a", "type", "has", "a", "given", "name", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/TypePredicates.java#L47-L49
47,822
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/TypePredicates.java
TypePredicates.inPackage
public static Predicate<Class<?>> inPackage(final String packageNamePrefix) { return clazz -> clazz.getPackage().getName().startsWith(packageNamePrefix); }
java
public static Predicate<Class<?>> inPackage(final String packageNamePrefix) { return clazz -> clazz.getPackage().getName().startsWith(packageNamePrefix); }
[ "public", "static", "Predicate", "<", "Class", "<", "?", ">", ">", "inPackage", "(", "final", "String", "packageNamePrefix", ")", "{", "return", "clazz", "->", "clazz", ".", "getPackage", "(", ")", ".", "getName", "(", ")", ".", "startsWith", "(", "packa...
Create a predicate to check that a type is defined in a given package. @param packageNamePrefix prefix of the package name @return Predicate to check that a type is defined in a given package.
[ "Create", "a", "predicate", "to", "check", "that", "a", "type", "is", "defined", "in", "a", "given", "package", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/TypePredicates.java#L67-L69
47,823
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/TypePredicates.java
TypePredicates.isAnnotatedWith
public static Predicate<Class<?>> isAnnotatedWith(Class<? extends Annotation>... annotations) { return clazz -> { for (Class<? extends Annotation> annotation : annotations) { if (clazz.isAnnotationPresent(annotation)) { return true; } }...
java
public static Predicate<Class<?>> isAnnotatedWith(Class<? extends Annotation>... annotations) { return clazz -> { for (Class<? extends Annotation> annotation : annotations) { if (clazz.isAnnotationPresent(annotation)) { return true; } }...
[ "public", "static", "Predicate", "<", "Class", "<", "?", ">", ">", "isAnnotatedWith", "(", "Class", "<", "?", "extends", "Annotation", ">", "...", "annotations", ")", "{", "return", "clazz", "->", "{", "for", "(", "Class", "<", "?", "extends", "Annotatio...
Create a predicate to check that a type is annotated with one of the given annotations. @param annotations present on the type @return Predicate to check that a type is annotated with one of the given annotations.
[ "Create", "a", "predicate", "to", "check", "that", "a", "type", "is", "annotated", "with", "one", "of", "the", "given", "annotations", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/TypePredicates.java#L77-L86
47,824
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/TypePredicates.java
TypePredicates.hasModifiers
public static Predicate<Class<?>> hasModifiers(final Integer modifiers) { return clazz -> (modifiers & clazz.getModifiers()) == modifiers; }
java
public static Predicate<Class<?>> hasModifiers(final Integer modifiers) { return clazz -> (modifiers & clazz.getModifiers()) == modifiers; }
[ "public", "static", "Predicate", "<", "Class", "<", "?", ">", ">", "hasModifiers", "(", "final", "Integer", "modifiers", ")", "{", "return", "clazz", "->", "(", "modifiers", "&", "clazz", ".", "getModifiers", "(", ")", ")", "==", "modifiers", ";", "}" ]
Create a predicate to check that a type has a given set of modifiers. @param modifiers of the type to check @return Predicate to check that a type has a given set of modifiers
[ "Create", "a", "predicate", "to", "check", "that", "a", "type", "has", "a", "given", "set", "of", "modifiers", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/TypePredicates.java#L121-L123
47,825
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/EasyRandomParameters.java
EasyRandomParameters.randomize
public <T> EasyRandomParameters randomize(Class<T> type, Randomizer<T> randomizer) { Objects.requireNonNull(type, "Type must not be null"); Objects.requireNonNull(randomizer, "Randomizer must not be null"); customRandomizerRegistry.registerRandomizer(type, randomizer); return this; }
java
public <T> EasyRandomParameters randomize(Class<T> type, Randomizer<T> randomizer) { Objects.requireNonNull(type, "Type must not be null"); Objects.requireNonNull(randomizer, "Randomizer must not be null"); customRandomizerRegistry.registerRandomizer(type, randomizer); return this; }
[ "public", "<", "T", ">", "EasyRandomParameters", "randomize", "(", "Class", "<", "T", ">", "type", ",", "Randomizer", "<", "T", ">", "randomizer", ")", "{", "Objects", ".", "requireNonNull", "(", "type", ",", "\"Type must not be null\"", ")", ";", "Objects",...
Register a custom randomizer for a given type. @param type class of the type to randomize @param randomizer the custom {@link Randomizer} to use @param <T> The field type @return the current {@link EasyRandomParameters} instance for method chaining
[ "Register", "a", "custom", "randomizer", "for", "a", "given", "type", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/EasyRandomParameters.java#L295-L300
47,826
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/EasyRandomParameters.java
EasyRandomParameters.excludeField
public EasyRandomParameters excludeField(Predicate<Field> predicate) { Objects.requireNonNull(predicate, "Predicate must not be null"); fieldExclusionPredicates.add(predicate); exclusionRandomizerRegistry.addFieldPredicate(predicate); return this; }
java
public EasyRandomParameters excludeField(Predicate<Field> predicate) { Objects.requireNonNull(predicate, "Predicate must not be null"); fieldExclusionPredicates.add(predicate); exclusionRandomizerRegistry.addFieldPredicate(predicate); return this; }
[ "public", "EasyRandomParameters", "excludeField", "(", "Predicate", "<", "Field", ">", "predicate", ")", "{", "Objects", ".", "requireNonNull", "(", "predicate", ",", "\"Predicate must not be null\"", ")", ";", "fieldExclusionPredicates", ".", "add", "(", "predicate",...
Exclude a field from being randomized. @param predicate to identify the field to exclude @return the current {@link EasyRandomParameters} instance for method chaining @see FieldPredicates
[ "Exclude", "a", "field", "from", "being", "randomized", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/EasyRandomParameters.java#L310-L315
47,827
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/EasyRandomParameters.java
EasyRandomParameters.excludeType
public EasyRandomParameters excludeType(Predicate<Class<?>> predicate) { Objects.requireNonNull(predicate, "Predicate must not be null"); typeExclusionPredicates.add(predicate); exclusionRandomizerRegistry.addTypePredicate(predicate); return this; }
java
public EasyRandomParameters excludeType(Predicate<Class<?>> predicate) { Objects.requireNonNull(predicate, "Predicate must not be null"); typeExclusionPredicates.add(predicate); exclusionRandomizerRegistry.addTypePredicate(predicate); return this; }
[ "public", "EasyRandomParameters", "excludeType", "(", "Predicate", "<", "Class", "<", "?", ">", ">", "predicate", ")", "{", "Objects", ".", "requireNonNull", "(", "predicate", ",", "\"Predicate must not be null\"", ")", ";", "typeExclusionPredicates", ".", "add", ...
Exclude a type from being randomized. @param predicate to identify the type to exclude @return the current {@link EasyRandomParameters} instance for method chaining @see FieldPredicates
[ "Exclude", "a", "type", "from", "being", "randomized", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/EasyRandomParameters.java#L325-L330
47,828
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/EasyRandomParameters.java
EasyRandomParameters.collectionSizeRange
public EasyRandomParameters collectionSizeRange(final int minCollectionSize, final int maxCollectionSize) { if (minCollectionSize < 0) { throw new IllegalArgumentException("minCollectionSize must be >= 0"); } if (minCollectionSize > maxCollectionSize) { throw new IllegalA...
java
public EasyRandomParameters collectionSizeRange(final int minCollectionSize, final int maxCollectionSize) { if (minCollectionSize < 0) { throw new IllegalArgumentException("minCollectionSize must be >= 0"); } if (minCollectionSize > maxCollectionSize) { throw new IllegalA...
[ "public", "EasyRandomParameters", "collectionSizeRange", "(", "final", "int", "minCollectionSize", ",", "final", "int", "maxCollectionSize", ")", "{", "if", "(", "minCollectionSize", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"minCollection...
Set the collection size range. @param minCollectionSize the minimum collection size @param maxCollectionSize the maximum collection size @return the current {@link EasyRandomParameters} instance for method chaining
[ "Set", "the", "collection", "size", "range", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/EasyRandomParameters.java#L383-L393
47,829
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/EasyRandomParameters.java
EasyRandomParameters.stringLengthRange
public EasyRandomParameters stringLengthRange(final int minStringLength, final int maxStringLength) { if (minStringLength < 0) { throw new IllegalArgumentException("minStringLength must be >= 0"); } if (minStringLength > maxStringLength) { throw new IllegalArgumentExcepti...
java
public EasyRandomParameters stringLengthRange(final int minStringLength, final int maxStringLength) { if (minStringLength < 0) { throw new IllegalArgumentException("minStringLength must be >= 0"); } if (minStringLength > maxStringLength) { throw new IllegalArgumentExcepti...
[ "public", "EasyRandomParameters", "stringLengthRange", "(", "final", "int", "minStringLength", ",", "final", "int", "maxStringLength", ")", "{", "if", "(", "minStringLength", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"minStringLength must ...
Set the string length range. @param minStringLength the minimum string length @param maxStringLength the maximum string length @return the current {@link EasyRandomParameters} instance for method chaining
[ "Set", "the", "string", "length", "range", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/EasyRandomParameters.java#L402-L412
47,830
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/EasyRandomParameters.java
EasyRandomParameters.dateRange
public EasyRandomParameters dateRange(final LocalDate min, final LocalDate max) { if (min.isAfter(max)) { throw new IllegalArgumentException("Min date should be before max date"); } setDateRange(new Range<>(min, max)); return this; }
java
public EasyRandomParameters dateRange(final LocalDate min, final LocalDate max) { if (min.isAfter(max)) { throw new IllegalArgumentException("Min date should be before max date"); } setDateRange(new Range<>(min, max)); return this; }
[ "public", "EasyRandomParameters", "dateRange", "(", "final", "LocalDate", "min", ",", "final", "LocalDate", "max", ")", "{", "if", "(", "min", ".", "isAfter", "(", "max", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Min date should be befor...
Set the date range. @param min date @param max date @return the current {@link EasyRandomParameters} instance for method chaining
[ "Set", "the", "date", "range", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/EasyRandomParameters.java#L455-L461
47,831
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/EasyRandomParameters.java
EasyRandomParameters.timeRange
public EasyRandomParameters timeRange(final LocalTime min, final LocalTime max) { if (min.isAfter(max)) { throw new IllegalArgumentException("Min time should be before max time"); } setTimeRange(new Range<>(min, max)); return this; }
java
public EasyRandomParameters timeRange(final LocalTime min, final LocalTime max) { if (min.isAfter(max)) { throw new IllegalArgumentException("Min time should be before max time"); } setTimeRange(new Range<>(min, max)); return this; }
[ "public", "EasyRandomParameters", "timeRange", "(", "final", "LocalTime", "min", ",", "final", "LocalTime", "max", ")", "{", "if", "(", "min", ".", "isAfter", "(", "max", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Min time should be befor...
Set the time range. @param min time @param max time @return the current {@link EasyRandomParameters} instance for method chaining
[ "Set", "the", "time", "range", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/EasyRandomParameters.java#L470-L476
47,832
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/ExclusionChecker.java
ExclusionChecker.shouldBeExcluded
public boolean shouldBeExcluded(final Field field, final RandomizerContext context) { if (isStatic(field)) { return true; } Set<Predicate<Field>> fieldExclusionPredicates = context.getParameters().getFieldExclusionPredicates(); for (Predicate<Field> fieldExclusionPredicate : ...
java
public boolean shouldBeExcluded(final Field field, final RandomizerContext context) { if (isStatic(field)) { return true; } Set<Predicate<Field>> fieldExclusionPredicates = context.getParameters().getFieldExclusionPredicates(); for (Predicate<Field> fieldExclusionPredicate : ...
[ "public", "boolean", "shouldBeExcluded", "(", "final", "Field", "field", ",", "final", "RandomizerContext", "context", ")", "{", "if", "(", "isStatic", "(", "field", ")", ")", "{", "return", "true", ";", "}", "Set", "<", "Predicate", "<", "Field", ">", "...
Given the current randomization context, should the field be excluded from being populated ? @param field the field to check @param context the current randomization context @return true if the field should be excluded, false otherwise
[ "Given", "the", "current", "randomization", "context", "should", "the", "field", "be", "excluded", "from", "being", "populated", "?" ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/ExclusionChecker.java#L50-L61
47,833
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/ExclusionChecker.java
ExclusionChecker.shouldBeExcluded
public boolean shouldBeExcluded(final Class<?> type, final RandomizerContext context) { Set<Predicate<Class<?>>> typeExclusionPredicates = context.getParameters().getTypeExclusionPredicates(); for (Predicate<Class<?>> typeExclusionPredicate : typeExclusionPredicates) { if (typeExclusionPredi...
java
public boolean shouldBeExcluded(final Class<?> type, final RandomizerContext context) { Set<Predicate<Class<?>>> typeExclusionPredicates = context.getParameters().getTypeExclusionPredicates(); for (Predicate<Class<?>> typeExclusionPredicate : typeExclusionPredicates) { if (typeExclusionPredi...
[ "public", "boolean", "shouldBeExcluded", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "RandomizerContext", "context", ")", "{", "Set", "<", "Predicate", "<", "Class", "<", "?", ">", ">", ">", "typeExclusionPredicates", "=", "context", ".", "...
Given the current randomization context, should the type be excluded from being populated ? @param type the type to check @param context the current randomization context @return true if the type should be excluded, false otherwise
[ "Given", "the", "current", "randomization", "context", "should", "the", "type", "be", "excluded", "from", "being", "populated", "?" ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/ExclusionChecker.java#L70-L78
47,834
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/util/CharacterUtils.java
CharacterUtils.collectPrintableCharactersOf
public static List<Character> collectPrintableCharactersOf(Charset charset) { List<Character> chars = new ArrayList<>(); for (int i = Character.MIN_VALUE; i < Character.MAX_VALUE; i++) { char character = (char) i; if (isPrintable(character)) { String characterAsSt...
java
public static List<Character> collectPrintableCharactersOf(Charset charset) { List<Character> chars = new ArrayList<>(); for (int i = Character.MIN_VALUE; i < Character.MAX_VALUE; i++) { char character = (char) i; if (isPrintable(character)) { String characterAsSt...
[ "public", "static", "List", "<", "Character", ">", "collectPrintableCharactersOf", "(", "Charset", "charset", ")", "{", "List", "<", "Character", ">", "chars", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "int", "i", "=", "Character", ".", "...
Returns a list of all printable charaters of the given charset. @param charset Charset to use @return list of printable characters
[ "Returns", "a", "list", "of", "all", "printable", "charaters", "of", "the", "given", "charset", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/CharacterUtils.java#L49-L63
47,835
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/util/CharacterUtils.java
CharacterUtils.filterLetters
public static List<Character> filterLetters(List<Character> characters) { return characters.stream().filter(Character::isLetter).collect(toList()); }
java
public static List<Character> filterLetters(List<Character> characters) { return characters.stream().filter(Character::isLetter).collect(toList()); }
[ "public", "static", "List", "<", "Character", ">", "filterLetters", "(", "List", "<", "Character", ">", "characters", ")", "{", "return", "characters", ".", "stream", "(", ")", ".", "filter", "(", "Character", "::", "isLetter", ")", ".", "collect", "(", ...
Keep only letters from a list of characters. @param characters to filter @return only letters
[ "Keep", "only", "letters", "from", "a", "list", "of", "characters", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/CharacterUtils.java#L70-L72
47,836
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/FieldPredicates.java
FieldPredicates.named
public static Predicate<Field> named(final String name) { return field -> Pattern.compile(name).matcher(field.getName()).matches(); }
java
public static Predicate<Field> named(final String name) { return field -> Pattern.compile(name).matcher(field.getName()).matches(); }
[ "public", "static", "Predicate", "<", "Field", ">", "named", "(", "final", "String", "name", ")", "{", "return", "field", "->", "Pattern", ".", "compile", "(", "name", ")", ".", "matcher", "(", "field", ".", "getName", "(", ")", ")", ".", "matches", ...
Create a predicate to check that a field has a certain name pattern. @param name pattern of the field name to check @return Predicate to check that a field has a certain name pattern
[ "Create", "a", "predicate", "to", "check", "that", "a", "field", "has", "a", "certain", "name", "pattern", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/FieldPredicates.java#L49-L51
47,837
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/FieldPredicates.java
FieldPredicates.ofType
public static Predicate<Field> ofType(Class<?> type) { return field -> field.getType().equals(type); }
java
public static Predicate<Field> ofType(Class<?> type) { return field -> field.getType().equals(type); }
[ "public", "static", "Predicate", "<", "Field", ">", "ofType", "(", "Class", "<", "?", ">", "type", ")", "{", "return", "field", "->", "field", ".", "getType", "(", ")", ".", "equals", "(", "type", ")", ";", "}" ]
Create a predicate to check that a field has a certain type. @param type of the field to check @return Predicate to check that a field has a certain type
[ "Create", "a", "predicate", "to", "check", "that", "a", "field", "has", "a", "certain", "type", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/FieldPredicates.java#L59-L61
47,838
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/FieldPredicates.java
FieldPredicates.inClass
public static Predicate<Field> inClass(Class<?> clazz) { return field -> field.getDeclaringClass().equals(clazz); }
java
public static Predicate<Field> inClass(Class<?> clazz) { return field -> field.getDeclaringClass().equals(clazz); }
[ "public", "static", "Predicate", "<", "Field", ">", "inClass", "(", "Class", "<", "?", ">", "clazz", ")", "{", "return", "field", "->", "field", ".", "getDeclaringClass", "(", ")", ".", "equals", "(", "clazz", ")", ";", "}" ]
Create a predicate to check that a field is defined in a given class. @param clazz enclosing type of the field to check @return Predicate to check that a field is defined in a given class.
[ "Create", "a", "predicate", "to", "check", "that", "a", "field", "is", "defined", "in", "a", "given", "class", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/FieldPredicates.java#L69-L71
47,839
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/FieldPredicates.java
FieldPredicates.isAnnotatedWith
public static Predicate<Field> isAnnotatedWith(Class<? extends Annotation>... annotations) { return field -> { for (Class<? extends Annotation> annotation : annotations) { if (field.isAnnotationPresent(annotation)) { return true; } } ...
java
public static Predicate<Field> isAnnotatedWith(Class<? extends Annotation>... annotations) { return field -> { for (Class<? extends Annotation> annotation : annotations) { if (field.isAnnotationPresent(annotation)) { return true; } } ...
[ "public", "static", "Predicate", "<", "Field", ">", "isAnnotatedWith", "(", "Class", "<", "?", "extends", "Annotation", ">", "...", "annotations", ")", "{", "return", "field", "->", "{", "for", "(", "Class", "<", "?", "extends", "Annotation", ">", "annotat...
Create a predicate to check that a field is annotated with one of the given annotations. @param annotations present on the field @return Predicate to check that a field is annotated with one of the given annotations.
[ "Create", "a", "predicate", "to", "check", "that", "a", "field", "is", "annotated", "with", "one", "of", "the", "given", "annotations", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/FieldPredicates.java#L79-L88
47,840
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/FieldPredicates.java
FieldPredicates.hasModifiers
public static Predicate<Field> hasModifiers(final Integer modifiers) { return field -> (modifiers & field.getModifiers()) == modifiers; }
java
public static Predicate<Field> hasModifiers(final Integer modifiers) { return field -> (modifiers & field.getModifiers()) == modifiers; }
[ "public", "static", "Predicate", "<", "Field", ">", "hasModifiers", "(", "final", "Integer", "modifiers", ")", "{", "return", "field", "->", "(", "modifiers", "&", "field", ".", "getModifiers", "(", ")", ")", "==", "modifiers", ";", "}" ]
Create a predicate to check that a field has a given set of modifiers. @param modifiers of the field to check @return Predicate to check that a field has a given set of modifiers
[ "Create", "a", "predicate", "to", "check", "that", "a", "field", "has", "a", "given", "set", "of", "modifiers", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/FieldPredicates.java#L96-L98
47,841
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/util/CollectionUtils.java
CollectionUtils.randomElementOf
public static <T> T randomElementOf(final List<T> list) { if (list.isEmpty()) { return null; } return list.get(nextInt(0, list.size())); }
java
public static <T> T randomElementOf(final List<T> list) { if (list.isEmpty()) { return null; } return list.get(nextInt(0, list.size())); }
[ "public", "static", "<", "T", ">", "T", "randomElementOf", "(", "final", "List", "<", "T", ">", "list", ")", "{", "if", "(", "list", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "return", "list", ".", "get", "(", "nextInt", "("...
Get a random element from the list. @param list the input list @param <T> the type of elements in the list @return a random element from the list or null if the list is empty
[ "Get", "a", "random", "element", "from", "the", "list", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/CollectionUtils.java#L46-L51
47,842
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/EasyRandom.java
EasyRandom.nextObject
public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); }
java
public <T> T nextObject(final Class<T> type) { return doPopulateBean(type, new RandomizationContext(type, parameters)); }
[ "public", "<", "T", ">", "T", "nextObject", "(", "final", "Class", "<", "T", ">", "type", ")", "{", "return", "doPopulateBean", "(", "type", ",", "new", "RandomizationContext", "(", "type", ",", "parameters", ")", ")", ";", "}" ]
Generate a random instance of the given type. @param type the type for which an instance will be generated @param <T> the actual type of the target object @return a random instance of the given type @throws ObjectCreationException when unable to create a new instance of the given type
[ "Generate", "a", "random", "instance", "of", "the", "given", "type", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/EasyRandom.java#L96-L98
47,843
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/EasyRandom.java
EasyRandom.objects
public <T> Stream<T> objects(final Class<T> type, final int streamSize) { if (streamSize < 0) { throw new IllegalArgumentException("The stream size must be positive"); } return Stream.generate(() -> nextObject(type)).limit(streamSize); }
java
public <T> Stream<T> objects(final Class<T> type, final int streamSize) { if (streamSize < 0) { throw new IllegalArgumentException("The stream size must be positive"); } return Stream.generate(() -> nextObject(type)).limit(streamSize); }
[ "public", "<", "T", ">", "Stream", "<", "T", ">", "objects", "(", "final", "Class", "<", "T", ">", "type", ",", "final", "int", "streamSize", ")", "{", "if", "(", "streamSize", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"T...
Generate a stream of random instances of the given type. @param type the type for which instances will be generated @param streamSize the number of instances to generate @param <T> the actual type of the target objects @return a stream of random instances of the given type @throws ObjectCr...
[ "Generate", "a", "stream", "of", "random", "instances", "of", "the", "given", "type", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/EasyRandom.java#L109-L115
47,844
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/randomizers/misc/EnumRandomizer.java
EnumRandomizer.getFilteredList
private List<E> getFilteredList(Class<E> enumeration, E... excludedValues) { List<E> filteredValues = new ArrayList<>(); Collections.addAll(filteredValues, enumeration.getEnumConstants()); if (excludedValues != null) { for (E element : excludedValues) { filteredValues...
java
private List<E> getFilteredList(Class<E> enumeration, E... excludedValues) { List<E> filteredValues = new ArrayList<>(); Collections.addAll(filteredValues, enumeration.getEnumConstants()); if (excludedValues != null) { for (E element : excludedValues) { filteredValues...
[ "private", "List", "<", "E", ">", "getFilteredList", "(", "Class", "<", "E", ">", "enumeration", ",", "E", "...", "excludedValues", ")", "{", "List", "<", "E", ">", "filteredValues", "=", "new", "ArrayList", "<>", "(", ")", ";", "Collections", ".", "ad...
Get a subset of enumeration. @return the enumeration values minus those excluded.
[ "Get", "a", "subset", "of", "enumeration", "." ]
816b0d6a74c7288af111e70ae1b0b57d7fe3b59d
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/randomizers/misc/EnumRandomizer.java#L136-L145
47,845
TNG/ArchUnit
archunit/src/main/java/com/tngtech/archunit/core/domain/JavaPackage.java
JavaPackage.accept
@PublicAPI(usage = ACCESS) public void accept(Predicate<? super JavaClass> predicate, ClassVisitor visitor) { for (JavaClass javaClass : getClassesWith(predicate)) { visitor.visit(javaClass); } for (JavaPackage subPackage : getSubPackages()) { subPackage.accept(predic...
java
@PublicAPI(usage = ACCESS) public void accept(Predicate<? super JavaClass> predicate, ClassVisitor visitor) { for (JavaClass javaClass : getClassesWith(predicate)) { visitor.visit(javaClass); } for (JavaPackage subPackage : getSubPackages()) { subPackage.accept(predic...
[ "@", "PublicAPI", "(", "usage", "=", "ACCESS", ")", "public", "void", "accept", "(", "Predicate", "<", "?", "super", "JavaClass", ">", "predicate", ",", "ClassVisitor", "visitor", ")", "{", "for", "(", "JavaClass", "javaClass", ":", "getClassesWith", "(", ...
Traverses the package tree visiting each matching class. @param predicate determines which classes within the package tree should be visited @param visitor will receive each class in the package tree matching the given predicate @see #accept(Predicate, PackageVisitor)
[ "Traverses", "the", "package", "tree", "visiting", "each", "matching", "class", "." ]
024c5d2502e91de6cb586b86c7084dbd12f3ef37
https://github.com/TNG/ArchUnit/blob/024c5d2502e91de6cb586b86c7084dbd12f3ef37/archunit/src/main/java/com/tngtech/archunit/core/domain/JavaPackage.java#L350-L358
47,846
TNG/ArchUnit
archunit/src/main/java/com/tngtech/archunit/core/domain/JavaPackage.java
JavaPackage.accept
@PublicAPI(usage = ACCESS) public void accept(Predicate<? super JavaPackage> predicate, PackageVisitor visitor) { if (predicate.apply(this)) { visitor.visit(this); } for (JavaPackage subPackage : getSubPackages()) { subPackage.accept(predicate, visitor); } ...
java
@PublicAPI(usage = ACCESS) public void accept(Predicate<? super JavaPackage> predicate, PackageVisitor visitor) { if (predicate.apply(this)) { visitor.visit(this); } for (JavaPackage subPackage : getSubPackages()) { subPackage.accept(predicate, visitor); } ...
[ "@", "PublicAPI", "(", "usage", "=", "ACCESS", ")", "public", "void", "accept", "(", "Predicate", "<", "?", "super", "JavaPackage", ">", "predicate", ",", "PackageVisitor", "visitor", ")", "{", "if", "(", "predicate", ".", "apply", "(", "this", ")", ")",...
Traverses the package tree visiting each matching package. @param predicate determines which packages within the package tree should be visited @param visitor will receive each package in the package tree matching the given predicate @see #accept(Predicate, ClassVisitor)
[ "Traverses", "the", "package", "tree", "visiting", "each", "matching", "package", "." ]
024c5d2502e91de6cb586b86c7084dbd12f3ef37
https://github.com/TNG/ArchUnit/blob/024c5d2502e91de6cb586b86c7084dbd12f3ef37/archunit/src/main/java/com/tngtech/archunit/core/domain/JavaPackage.java#L366-L374
47,847
TNG/ArchUnit
archunit-example/example-plain/src/main/java/com/tngtech/archunit/example/ClassViolatingCodingRules.java
ClassViolatingCodingRules.printToStandardStream
public void printToStandardStream() throws FileNotFoundException { System.out.println("I'm gonna print to the command line"); // Violates rule not to write to standard streams System.err.println("I'm gonna print to the command line"); // Violates rule not to write to standard streams new SomeCus...
java
public void printToStandardStream() throws FileNotFoundException { System.out.println("I'm gonna print to the command line"); // Violates rule not to write to standard streams System.err.println("I'm gonna print to the command line"); // Violates rule not to write to standard streams new SomeCus...
[ "public", "void", "printToStandardStream", "(", ")", "throws", "FileNotFoundException", "{", "System", ".", "out", ".", "println", "(", "\"I'm gonna print to the command line\"", ")", ";", "// Violates rule not to write to standard streams", "System", ".", "err", ".", "pr...
Violates rules not to use java.util.logging & that loggers should be private static final
[ "Violates", "rules", "not", "to", "use", "java", ".", "util", ".", "logging", "&", "that", "loggers", "should", "be", "private", "static", "final" ]
024c5d2502e91de6cb586b86c7084dbd12f3ef37
https://github.com/TNG/ArchUnit/blob/024c5d2502e91de6cb586b86c7084dbd12f3ef37/archunit-example/example-plain/src/main/java/com/tngtech/archunit/example/ClassViolatingCodingRules.java#L11-L18
47,848
b3log/latke
latke-core/src/main/java/org/json/JSONTokener.java
JSONTokener.back
public void back() throws JSONException { if (this.usePrevious || this.index <= 0) { throw new JSONException("Stepping back two steps is not supported"); } this.decrementIndexes(); this.usePrevious = true; this.eof = false; }
java
public void back() throws JSONException { if (this.usePrevious || this.index <= 0) { throw new JSONException("Stepping back two steps is not supported"); } this.decrementIndexes(); this.usePrevious = true; this.eof = false; }
[ "public", "void", "back", "(", ")", "throws", "JSONException", "{", "if", "(", "this", ".", "usePrevious", "||", "this", ".", "index", "<=", "0", ")", "{", "throw", "new", "JSONException", "(", "\"Stepping back two steps is not supported\"", ")", ";", "}", "...
Back up one character. This provides a sort of lookahead capability, so that you can test for a digit or letter before attempting to parse the next number or identifier. @throws JSONException Thrown if trying to step back more than 1 step or if already at the start of the string
[ "Back", "up", "one", "character", ".", "This", "provides", "a", "sort", "of", "lookahead", "capability", "so", "that", "you", "can", "test", "for", "a", "digit", "or", "letter", "before", "attempting", "to", "parse", "the", "next", "number", "or", "identif...
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONTokener.java#L105-L112
47,849
b3log/latke
latke-core/src/main/java/org/json/JSONTokener.java
JSONTokener.incrementIndexes
private void incrementIndexes(int c) { if(c > 0) { this.index++; if(c=='\r') { this.line++; this.characterPreviousLine = this.character; this.character=0; }else if (c=='\n') { if(this.previous != '\r') { ...
java
private void incrementIndexes(int c) { if(c > 0) { this.index++; if(c=='\r') { this.line++; this.characterPreviousLine = this.character; this.character=0; }else if (c=='\n') { if(this.previous != '\r') { ...
[ "private", "void", "incrementIndexes", "(", "int", "c", ")", "{", "if", "(", "c", ">", "0", ")", "{", "this", ".", "index", "++", ";", "if", "(", "c", "==", "'", "'", ")", "{", "this", ".", "line", "++", ";", "this", ".", "characterPreviousLine",...
Increments the internal indexes according to the previous character read and the character passed as the current character. @param c the current character read.
[ "Increments", "the", "internal", "indexes", "according", "to", "the", "previous", "character", "read", "and", "the", "character", "passed", "as", "the", "current", "character", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONTokener.java#L218-L235
47,850
b3log/latke
latke-core/src/main/java/org/json/JSONTokener.java
JSONTokener.syntaxError
public JSONException syntaxError(String message, Throwable causedBy) { return new JSONException(message + this.toString(), causedBy); }
java
public JSONException syntaxError(String message, Throwable causedBy) { return new JSONException(message + this.toString(), causedBy); }
[ "public", "JSONException", "syntaxError", "(", "String", "message", ",", "Throwable", "causedBy", ")", "{", "return", "new", "JSONException", "(", "message", "+", "this", ".", "toString", "(", ")", ",", "causedBy", ")", ";", "}" ]
Make a JSONException to signal a syntax error. @param message The error message. @param causedBy The throwable that caused the error. @return A JSONException object, suitable for throwing
[ "Make", "a", "JSONException", "to", "signal", "a", "syntax", "error", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONTokener.java#L515-L517
47,851
b3log/latke
latke-core/src/main/java/org/json/JSONPointer.java
JSONPointer.readByIndexToken
private Object readByIndexToken(Object current, String indexToken) throws JSONPointerException { try { int index = Integer.parseInt(indexToken); JSONArray currentArr = (JSONArray) current; if (index >= currentArr.length()) { throw new JSONPointerException(form...
java
private Object readByIndexToken(Object current, String indexToken) throws JSONPointerException { try { int index = Integer.parseInt(indexToken); JSONArray currentArr = (JSONArray) current; if (index >= currentArr.length()) { throw new JSONPointerException(form...
[ "private", "Object", "readByIndexToken", "(", "Object", "current", ",", "String", "indexToken", ")", "throws", "JSONPointerException", "{", "try", "{", "int", "index", "=", "Integer", ".", "parseInt", "(", "indexToken", ")", ";", "JSONArray", "currentArr", "=", ...
Matches a JSONArray element by ordinal position @param current the JSONArray to be evaluated @param indexToken the array index in string form @return the matched object. If no matching item is found a @throws JSONPointerException is thrown if the index is out of bounds
[ "Matches", "a", "JSONArray", "element", "by", "ordinal", "position" ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONPointer.java#L231-L247
47,852
b3log/latke
latke-core/src/main/java/org/json/JSONPointer.java
JSONPointer.toURIFragment
public String toURIFragment() { try { StringBuilder rval = new StringBuilder("#"); for (String token : this.refTokens) { rval.append('/').append(URLEncoder.encode(token, ENCODING)); } return rval.toString(); } catch (UnsupportedEncodingExce...
java
public String toURIFragment() { try { StringBuilder rval = new StringBuilder("#"); for (String token : this.refTokens) { rval.append('/').append(URLEncoder.encode(token, ENCODING)); } return rval.toString(); } catch (UnsupportedEncodingExce...
[ "public", "String", "toURIFragment", "(", ")", "{", "try", "{", "StringBuilder", "rval", "=", "new", "StringBuilder", "(", "\"#\"", ")", ";", "for", "(", "String", "token", ":", "this", ".", "refTokens", ")", "{", "rval", ".", "append", "(", "'", "'", ...
Returns a string representing the JSONPointer path value using URI fragment identifier representation
[ "Returns", "a", "string", "representing", "the", "JSONPointer", "path", "value", "using", "URI", "fragment", "identifier", "representation" ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONPointer.java#L281-L291
47,853
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/util/JdbcUtil.java
JdbcUtil.executeSql
public static boolean executeSql(final String sql, final Connection connection, final boolean isDebug) throws SQLException { if (isDebug || LOGGER.isTraceEnabled()) { LOGGER.log(Level.INFO, "Executing SQL [" + sql + "]"); } final Statement statement = connection.createStatement(); ...
java
public static boolean executeSql(final String sql, final Connection connection, final boolean isDebug) throws SQLException { if (isDebug || LOGGER.isTraceEnabled()) { LOGGER.log(Level.INFO, "Executing SQL [" + sql + "]"); } final Statement statement = connection.createStatement(); ...
[ "public", "static", "boolean", "executeSql", "(", "final", "String", "sql", ",", "final", "Connection", "connection", ",", "final", "boolean", "isDebug", ")", "throws", "SQLException", "{", "if", "(", "isDebug", "||", "LOGGER", ".", "isTraceEnabled", "(", ")",...
Executes the specified SQL with the specified connection. @param sql the specified SQL @param connection connection the specified connection @param isDebug the specified debug flag @return {@code true} if success, returns {@false} otherwise @throws SQLException SQLException
[ "Executes", "the", "specified", "SQL", "with", "the", "specified", "connection", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/util/JdbcUtil.java#L60-L70
47,854
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/util/JdbcUtil.java
JdbcUtil.executeSql
public static boolean executeSql(final String sql, final List<Object> paramList, final Connection connection, final boolean isDebug) throws SQLException { if (isDebug || LOGGER.isTraceEnabled()) { LOGGER.log(Level.INFO, "Executing SQL [" + sql + "]"); } final PreparedStatement prepa...
java
public static boolean executeSql(final String sql, final List<Object> paramList, final Connection connection, final boolean isDebug) throws SQLException { if (isDebug || LOGGER.isTraceEnabled()) { LOGGER.log(Level.INFO, "Executing SQL [" + sql + "]"); } final PreparedStatement prepa...
[ "public", "static", "boolean", "executeSql", "(", "final", "String", "sql", ",", "final", "List", "<", "Object", ">", "paramList", ",", "final", "Connection", "connection", ",", "final", "boolean", "isDebug", ")", "throws", "SQLException", "{", "if", "(", "i...
Executes the specified SQL with the specified params and connection... @param sql the specified SQL @param paramList the specified params @param connection the specified connection @param isDebug the specified debug flag @return {@code true} if success, returns {@false} otherwise @throws SQLException SQLExc...
[ "Executes", "the", "specified", "SQL", "with", "the", "specified", "params", "and", "connection", "..." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/util/JdbcUtil.java#L82-L95
47,855
b3log/latke
latke-core/src/main/java/org/b3log/latke/servlet/renderer/AbstractFreeMarkerRenderer.java
AbstractFreeMarkerRenderer.genHTML
protected String genHTML(final HttpServletRequest request, final Map<String, Object> dataModel, final Template template) throws Exception { final StringWriter stringWriter = new StringWriter(); template.setOutputEncoding("UTF-8"); template.process(dataModel, stringWriter); f...
java
protected String genHTML(final HttpServletRequest request, final Map<String, Object> dataModel, final Template template) throws Exception { final StringWriter stringWriter = new StringWriter(); template.setOutputEncoding("UTF-8"); template.process(dataModel, stringWriter); f...
[ "protected", "String", "genHTML", "(", "final", "HttpServletRequest", "request", ",", "final", "Map", "<", "String", ",", "Object", ">", "dataModel", ",", "final", "Template", "template", ")", "throws", "Exception", "{", "final", "StringWriter", "stringWriter", ...
Processes the specified FreeMarker template with the specified request, data model. @param request the specified request @param dataModel the specified data model @param template the specified FreeMarker template @return generated HTML @throws Exception exception
[ "Processes", "the", "specified", "FreeMarker", "template", "with", "the", "specified", "request", "data", "model", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/renderer/AbstractFreeMarkerRenderer.java#L150-L165
47,856
b3log/latke
latke-core/src/main/java/org/b3log/latke/ioc/Discoverer.java
Discoverer.discover
public static Collection<Class<?>> discover(final String scanPath) throws Exception { if (StringUtils.isBlank(scanPath)) { throw new IllegalStateException("Please specify the [scanPath]"); } LOGGER.debug("scanPath[" + scanPath + "]"); final Collection<Class<?>> ret = new Ha...
java
public static Collection<Class<?>> discover(final String scanPath) throws Exception { if (StringUtils.isBlank(scanPath)) { throw new IllegalStateException("Please specify the [scanPath]"); } LOGGER.debug("scanPath[" + scanPath + "]"); final Collection<Class<?>> ret = new Ha...
[ "public", "static", "Collection", "<", "Class", "<", "?", ">", ">", "discover", "(", "final", "String", "scanPath", ")", "throws", "Exception", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "scanPath", ")", ")", "{", "throw", "new", "IllegalStateExce...
Scans classpath to discover bean classes. @param scanPath the paths to scan, using ',' as the separator. There are two types of the scanPath: <ul> <li>package: org.b3log.process</li> <li>ant-style classpath: org/b3log/** /*process.class</li> </ul> @return discovered classes @throws Exception exception
[ "Scans", "classpath", "to", "discover", "bean", "classes", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/ioc/Discoverer.java#L74-L148
47,857
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Crypts.java
Crypts.signHmacSHA1
public static String signHmacSHA1(final String source, final String secret) { try { final Mac mac = Mac.getInstance("HmacSHA1"); mac.init(new SecretKeySpec(secret.getBytes("UTF-8"), "HmacSHA1")); final byte[] signData = mac.doFinal(source.getBytes("UTF-8")); retu...
java
public static String signHmacSHA1(final String source, final String secret) { try { final Mac mac = Mac.getInstance("HmacSHA1"); mac.init(new SecretKeySpec(secret.getBytes("UTF-8"), "HmacSHA1")); final byte[] signData = mac.doFinal(source.getBytes("UTF-8")); retu...
[ "public", "static", "String", "signHmacSHA1", "(", "final", "String", "source", ",", "final", "String", "secret", ")", "{", "try", "{", "final", "Mac", "mac", "=", "Mac", ".", "getInstance", "(", "\"HmacSHA1\"", ")", ";", "mac", ".", "init", "(", "new", ...
Signs the specified source string using the specified secret. @param source the specified source string @param secret the specified secret @return signed string
[ "Signs", "the", "specified", "source", "string", "using", "the", "specified", "secret", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Crypts.java#L46-L56
47,858
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Crypts.java
Crypts.encryptByAES
public static String encryptByAES(final String content, final String key) { try { final KeyGenerator kgen = KeyGenerator.getInstance("AES"); final SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); secureRandom.setSeed(key.getBytes()); kgen.init(128...
java
public static String encryptByAES(final String content, final String key) { try { final KeyGenerator kgen = KeyGenerator.getInstance("AES"); final SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); secureRandom.setSeed(key.getBytes()); kgen.init(128...
[ "public", "static", "String", "encryptByAES", "(", "final", "String", "content", ",", "final", "String", "key", ")", "{", "try", "{", "final", "KeyGenerator", "kgen", "=", "KeyGenerator", ".", "getInstance", "(", "\"AES\"", ")", ";", "final", "SecureRandom", ...
Encrypts by AES. @param content the specified content to encrypt @param key the specified key @return encrypted content @see #decryptByAES(java.lang.String, java.lang.String)
[ "Encrypts", "by", "AES", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Crypts.java#L71-L91
47,859
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Crypts.java
Crypts.decryptByAES
public static String decryptByAES(final String content, final String key) { try { final byte[] data = Hex.decodeHex(content.toCharArray()); final KeyGenerator kgen = KeyGenerator.getInstance("AES"); final SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); ...
java
public static String decryptByAES(final String content, final String key) { try { final byte[] data = Hex.decodeHex(content.toCharArray()); final KeyGenerator kgen = KeyGenerator.getInstance("AES"); final SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); ...
[ "public", "static", "String", "decryptByAES", "(", "final", "String", "content", ",", "final", "String", "key", ")", "{", "try", "{", "final", "byte", "[", "]", "data", "=", "Hex", ".", "decodeHex", "(", "content", ".", "toCharArray", "(", ")", ")", ";...
Decrypts by AES. @param content the specified content to decrypt @param key the specified key @return original content @see #encryptByAES(java.lang.String, java.lang.String)
[ "Decrypts", "by", "AES", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Crypts.java#L101-L121
47,860
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Ids.java
Ids.genTimeMillisId
public static synchronized String genTimeMillisId() { String ret; ID_GEN_LOCK.lock(); try { ret = String.valueOf(System.currentTimeMillis()); try { Thread.sleep(ID_GEN_SLEEP_MILLIS); } catch (final InterruptedException e) { th...
java
public static synchronized String genTimeMillisId() { String ret; ID_GEN_LOCK.lock(); try { ret = String.valueOf(System.currentTimeMillis()); try { Thread.sleep(ID_GEN_SLEEP_MILLIS); } catch (final InterruptedException e) { th...
[ "public", "static", "synchronized", "String", "genTimeMillisId", "(", ")", "{", "String", "ret", ";", "ID_GEN_LOCK", ".", "lock", "(", ")", ";", "try", "{", "ret", "=", "String", ".", "valueOf", "(", "System", ".", "currentTimeMillis", "(", ")", ")", ";"...
Gets current date time string. <p> <b>Note</b>: This method is not safe in cluster environment. </p> @return a time millis string
[ "Gets", "current", "date", "time", "string", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Ids.java#L54-L71
47,861
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Locales.java
Locales.hasLocale
public static boolean hasLocale(final Locale locale) { try { ResourceBundle.getBundle(Keys.LANGUAGE, locale); return true; } catch (final MissingResourceException e) { return false; } }
java
public static boolean hasLocale(final Locale locale) { try { ResourceBundle.getBundle(Keys.LANGUAGE, locale); return true; } catch (final MissingResourceException e) { return false; } }
[ "public", "static", "boolean", "hasLocale", "(", "final", "Locale", "locale", ")", "{", "try", "{", "ResourceBundle", ".", "getBundle", "(", "Keys", ".", "LANGUAGE", ",", "locale", ")", ";", "return", "true", ";", "}", "catch", "(", "final", "MissingResour...
Determines whether the server has the specified locale configuration or not. @param locale the specified locale @return {@code true} if the server has the specified locale, {@code false} otherwise
[ "Determines", "whether", "the", "server", "has", "the", "specified", "locale", "configuration", "or", "not", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Locales.java#L133-L141
47,862
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Locales.java
Locales.setLocale
public static void setLocale(final HttpServletRequest request, final Locale locale) { final HttpSession session = request.getSession(false); if (null == session) { LOGGER.warn("Ignores set locale caused by no session"); return; } session.setAttribute(Keys.LOCAL...
java
public static void setLocale(final HttpServletRequest request, final Locale locale) { final HttpSession session = request.getSession(false); if (null == session) { LOGGER.warn("Ignores set locale caused by no session"); return; } session.setAttribute(Keys.LOCAL...
[ "public", "static", "void", "setLocale", "(", "final", "HttpServletRequest", "request", ",", "final", "Locale", "locale", ")", "{", "final", "HttpSession", "session", "=", "request", ".", "getSession", "(", "false", ")", ";", "if", "(", "null", "==", "sessio...
Sets the specified locale into session of the specified request. <p> If no session of the specified request, do nothing. </p> @param request the specified request @param locale a new locale
[ "Sets", "the", "specified", "locale", "into", "session", "of", "the", "specified", "request", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Locales.java#L153-L164
47,863
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Locales.java
Locales.getLocale
public static Locale getLocale() { final Locale ret = LOCALE.get(); if (null == ret) { return Latkes.getLocale(); } return ret; }
java
public static Locale getLocale() { final Locale ret = LOCALE.get(); if (null == ret) { return Latkes.getLocale(); } return ret; }
[ "public", "static", "Locale", "getLocale", "(", ")", "{", "final", "Locale", "ret", "=", "LOCALE", ".", "get", "(", ")", ";", "if", "(", "null", "==", "ret", ")", "{", "return", "Latkes", ".", "getLocale", "(", ")", ";", "}", "return", "ret", ";", ...
Gets locale. @return locale
[ "Gets", "locale", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Locales.java#L180-L187
47,864
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Locales.java
Locales.getCountry
public static String getCountry(final String localeString) { if (localeString.length() >= COUNTRY_END) { return localeString.substring(COUNTRY_START, COUNTRY_END); } return ""; }
java
public static String getCountry(final String localeString) { if (localeString.length() >= COUNTRY_END) { return localeString.substring(COUNTRY_START, COUNTRY_END); } return ""; }
[ "public", "static", "String", "getCountry", "(", "final", "String", "localeString", ")", "{", "if", "(", "localeString", ".", "length", "(", ")", ">=", "COUNTRY_END", ")", "{", "return", "localeString", ".", "substring", "(", "COUNTRY_START", ",", "COUNTRY_END...
Gets country from the specified locale string. @param localeString the specified locale string @return country, if the length of specified locale string less than 5, returns ""
[ "Gets", "country", "from", "the", "specified", "locale", "string", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Locales.java#L195-L201
47,865
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Locales.java
Locales.getLanguage
public static String getLanguage(final String localeString) { if (localeString.length() >= LANG_END) { return localeString.substring(LANG_START, LANG_END); } return ""; }
java
public static String getLanguage(final String localeString) { if (localeString.length() >= LANG_END) { return localeString.substring(LANG_START, LANG_END); } return ""; }
[ "public", "static", "String", "getLanguage", "(", "final", "String", "localeString", ")", "{", "if", "(", "localeString", ".", "length", "(", ")", ">=", "LANG_END", ")", "{", "return", "localeString", ".", "substring", "(", "LANG_START", ",", "LANG_END", ")"...
Gets language from the specified locale string. @param localeString the specified locale string @return language, if the length of specified locale string less than 2, returns ""
[ "Gets", "language", "from", "the", "specified", "locale", "string", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Locales.java#L209-L215
47,866
b3log/latke
latke-repository-sqlserver/src/main/java/org/b3log/latke/repository/sqlserver/SQLServerJdbcDatabaseSolution.java
SQLServerJdbcDatabaseSolution.createKeyDefinition
private String createKeyDefinition(final List<FieldDefinition> keyDefinitionList) { final StringBuilder sql = new StringBuilder(); sql.append(" PRIMARY KEY"); boolean isFirst = true; for (FieldDefinition fieldDefinition : keyDefinitionList) { if (isFirst) { ...
java
private String createKeyDefinition(final List<FieldDefinition> keyDefinitionList) { final StringBuilder sql = new StringBuilder(); sql.append(" PRIMARY KEY"); boolean isFirst = true; for (FieldDefinition fieldDefinition : keyDefinitionList) { if (isFirst) { ...
[ "private", "String", "createKeyDefinition", "(", "final", "List", "<", "FieldDefinition", ">", "keyDefinitionList", ")", "{", "final", "StringBuilder", "sql", "=", "new", "StringBuilder", "(", ")", ";", "sql", ".", "append", "(", "\" PRIMARY KEY\"", ")", ";", ...
the keyDefinitionList tableSql. @param keyDefinitionList keyDefinitionList @return createKeyDefinitionsql
[ "the", "keyDefinitionList", "tableSql", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-repository-sqlserver/src/main/java/org/b3log/latke/repository/sqlserver/SQLServerJdbcDatabaseSolution.java#L170-L189
47,867
b3log/latke
latke-core/src/main/java/org/json/Cookie.java
Cookie.escape
public static String escape(String string) { char c; String s = string.trim(); int length = s.length(); StringBuilder sb = new StringBuilder(length); for (int i = 0; i < length; i += 1) { c = s.charAt(i); if (c < ' ' || c ...
java
public static String escape(String string) { char c; String s = string.trim(); int length = s.length(); StringBuilder sb = new StringBuilder(length); for (int i = 0; i < length; i += 1) { c = s.charAt(i); if (c < ' ' || c ...
[ "public", "static", "String", "escape", "(", "String", "string", ")", "{", "char", "c", ";", "String", "s", "=", "string", ".", "trim", "(", ")", ";", "int", "length", "=", "s", ".", "length", "(", ")", ";", "StringBuilder", "sb", "=", "new", "Stri...
Produce a copy of a string in which the characters '+', '%', '=', ';' and control characters are replaced with "%hh". This is a gentle form of URL encoding, attempting to cause as little distortion to the string as possible. The characters '=' and ';' are meta characters in cookies. By convention, they are escaped usin...
[ "Produce", "a", "copy", "of", "a", "string", "in", "which", "the", "characters", "+", "%", "=", ";", "and", "control", "characters", "are", "replaced", "with", "%hh", ".", "This", "is", "a", "gentle", "form", "of", "URL", "encoding", "attempting", "to", ...
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/Cookie.java#L47-L63
47,868
b3log/latke
latke-core/src/main/java/org/b3log/latke/ioc/SingletonContext.java
SingletonContext.getReference
private <T> T getReference(final Bean<T> bean) { T ret = (T) beanReferences.get(bean); if (null != ret) { return ret; } ret = bean.create(); if (null != ret) { beanReferences.put(bean, ret); return ret; } throw new RuntimeE...
java
private <T> T getReference(final Bean<T> bean) { T ret = (T) beanReferences.get(bean); if (null != ret) { return ret; } ret = bean.create(); if (null != ret) { beanReferences.put(bean, ret); return ret; } throw new RuntimeE...
[ "private", "<", "T", ">", "T", "getReference", "(", "final", "Bean", "<", "T", ">", "bean", ")", "{", "T", "ret", "=", "(", "T", ")", "beanReferences", ".", "get", "(", "bean", ")", ";", "if", "(", "null", "!=", "ret", ")", "{", "return", "ret"...
Gets reference of the specified bean and creational context. @param <T> the type of contextual @param bean the specified bean @return reference
[ "Gets", "reference", "of", "the", "specified", "bean", "and", "creational", "context", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/ioc/SingletonContext.java#L60-L76
47,869
b3log/latke
latke-core/src/main/java/org/b3log/latke/ioc/SingletonContext.java
SingletonContext.destroyReference
private <T> void destroyReference(final Bean<T> bean, final T beanInstance) { bean.destroy(beanInstance); }
java
private <T> void destroyReference(final Bean<T> bean, final T beanInstance) { bean.destroy(beanInstance); }
[ "private", "<", "T", ">", "void", "destroyReference", "(", "final", "Bean", "<", "T", ">", "bean", ",", "final", "T", "beanInstance", ")", "{", "bean", ".", "destroy", "(", "beanInstance", ")", ";", "}" ]
Destroys the specified bean's instance. @param <T> the type of contextual @param bean the specified bean @param beanInstance the specified bean's instance
[ "Destroys", "the", "specified", "bean", "s", "instance", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/ioc/SingletonContext.java#L104-L106
47,870
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java
JdbcRepository.dispose
public static void dispose() { final JdbcTransaction jdbcTransaction = TX.get(); if (null != jdbcTransaction && jdbcTransaction.getConnection() != null) { jdbcTransaction.dispose(); } final Connection connection = CONN.get(); if (null != connection) { tr...
java
public static void dispose() { final JdbcTransaction jdbcTransaction = TX.get(); if (null != jdbcTransaction && jdbcTransaction.getConnection() != null) { jdbcTransaction.dispose(); } final Connection connection = CONN.get(); if (null != connection) { tr...
[ "public", "static", "void", "dispose", "(", ")", "{", "final", "JdbcTransaction", "jdbcTransaction", "=", "TX", ".", "get", "(", ")", ";", "if", "(", "null", "!=", "jdbcTransaction", "&&", "jdbcTransaction", ".", "getConnection", "(", ")", "!=", "null", ")...
Disposes the resources.
[ "Disposes", "the", "resources", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java#L114-L131
47,871
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java
JdbcRepository.update
private void update(final String id, final JSONObject oldJsonObject, final JSONObject jsonObject, final List<Object> paramList, final StringBuilder sql) throws JSONException { final JSONObject needUpdateJsonObject = getNeedUpdateJsonObject(oldJsonObject, jsonObject); if (0 == nee...
java
private void update(final String id, final JSONObject oldJsonObject, final JSONObject jsonObject, final List<Object> paramList, final StringBuilder sql) throws JSONException { final JSONObject needUpdateJsonObject = getNeedUpdateJsonObject(oldJsonObject, jsonObject); if (0 == nee...
[ "private", "void", "update", "(", "final", "String", "id", ",", "final", "JSONObject", "oldJsonObject", ",", "final", "JSONObject", "jsonObject", ",", "final", "List", "<", "Object", ">", "paramList", ",", "final", "StringBuilder", "sql", ")", "throws", "JSONE...
Compares the specified old json object and new json object, updates it if need. @param id id @param oldJsonObject the specified old json object @param jsonObject the specified new json object @param paramList paramList @param sql sql @throws JSONException JSONException
[ "Compares", "the", "specified", "old", "json", "object", "and", "new", "json", "object", "updates", "it", "if", "need", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java#L275-L285
47,872
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java
JdbcRepository.getNeedUpdateJsonObject
private JSONObject getNeedUpdateJsonObject(final JSONObject oldJsonObject, final JSONObject jsonObject) throws JSONException { if (null == oldJsonObject) { return jsonObject; } final JSONObject ret = new JSONObject(); final Iterator<String> keys = jsonObject.keys(); ...
java
private JSONObject getNeedUpdateJsonObject(final JSONObject oldJsonObject, final JSONObject jsonObject) throws JSONException { if (null == oldJsonObject) { return jsonObject; } final JSONObject ret = new JSONObject(); final Iterator<String> keys = jsonObject.keys(); ...
[ "private", "JSONObject", "getNeedUpdateJsonObject", "(", "final", "JSONObject", "oldJsonObject", ",", "final", "JSONObject", "jsonObject", ")", "throws", "JSONException", "{", "if", "(", "null", "==", "oldJsonObject", ")", "{", "return", "jsonObject", ";", "}", "f...
Compares the specified old json object and the new json object, returns diff object for updating. @param oldJsonObject the specified old json object @param jsonObject the specified new json object @return diff object for updating @throws JSONException jsonObject
[ "Compares", "the", "specified", "old", "json", "object", "and", "the", "new", "json", "object", "returns", "diff", "object", "for", "updating", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java#L329-L347
47,873
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java
JdbcRepository.remove
private void remove(final String id, final StringBuilder sql) { sql.append("DELETE FROM ").append(getName()).append(" WHERE ").append(JdbcRepositories.getDefaultKeyName()).append(" = '"). append(id).append("'"); }
java
private void remove(final String id, final StringBuilder sql) { sql.append("DELETE FROM ").append(getName()).append(" WHERE ").append(JdbcRepositories.getDefaultKeyName()).append(" = '"). append(id).append("'"); }
[ "private", "void", "remove", "(", "final", "String", "id", ",", "final", "StringBuilder", "sql", ")", "{", "sql", ".", "append", "(", "\"DELETE FROM \"", ")", ".", "append", "(", "getName", "(", ")", ")", ".", "append", "(", "\" WHERE \"", ")", ".", "a...
Removes an record. @param id id @param sql sql
[ "Removes", "an", "record", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java#L400-L403
47,874
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java
JdbcRepository.buildSQLCount
private Map<String, Object> buildSQLCount(final int currentPageNum, final int pageSize, final int pageCount, final Query query, final StringBuilder sqlBuilder, final List<Object> paramList) throws RepositoryException { final Map<String, Object> ret = new HashMap<>()...
java
private Map<String, Object> buildSQLCount(final int currentPageNum, final int pageSize, final int pageCount, final Query query, final StringBuilder sqlBuilder, final List<Object> paramList) throws RepositoryException { final Map<String, Object> ret = new HashMap<>()...
[ "private", "Map", "<", "String", ",", "Object", ">", "buildSQLCount", "(", "final", "int", "currentPageNum", ",", "final", "int", "pageSize", ",", "final", "int", "pageCount", ",", "final", "Query", "query", ",", "final", "StringBuilder", "sqlBuilder", ",", ...
Builds query SQL and count result. @param currentPageNum currentPageNum @param pageSize pageSize @param pageCount if the pageCount specified with {@code -1}, the returned (pageCnt, recordCnt) value will be calculated, otherwise, the returned pageCnt will be this pageCount, and recordCnt will be {@code 0}, m...
[ "Builds", "query", "SQL", "and", "count", "result", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java#L533-L573
47,875
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java
JdbcRepository.buildSelect
private void buildSelect(final StringBuilder selectBuilder, final List<Projection> projections) { selectBuilder.append("SELECT "); if (null == projections || projections.isEmpty()) { selectBuilder.append(" * "); return; } selectBuilder.append(projections.stream(...
java
private void buildSelect(final StringBuilder selectBuilder, final List<Projection> projections) { selectBuilder.append("SELECT "); if (null == projections || projections.isEmpty()) { selectBuilder.append(" * "); return; } selectBuilder.append(projections.stream(...
[ "private", "void", "buildSelect", "(", "final", "StringBuilder", "selectBuilder", ",", "final", "List", "<", "Projection", ">", "projections", ")", "{", "selectBuilder", ".", "append", "(", "\"SELECT \"", ")", ";", "if", "(", "null", "==", "projections", "||",...
Builds 'SELECT' part with the specified select build and projections. @param selectBuilder the specified select builder @param projections the specified projections
[ "Builds", "SELECT", "part", "with", "the", "specified", "select", "build", "and", "projections", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java#L581-L590
47,876
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java
JdbcRepository.buildWhere
private void buildWhere(final StringBuilder whereBuilder, final List<Object> paramList, final Filter filter) throws RepositoryException { if (null == filter) { return; } if (filter instanceof PropertyFilter) { processPropertyFilter(whereBuilder, paramList, (PropertyFilte...
java
private void buildWhere(final StringBuilder whereBuilder, final List<Object> paramList, final Filter filter) throws RepositoryException { if (null == filter) { return; } if (filter instanceof PropertyFilter) { processPropertyFilter(whereBuilder, paramList, (PropertyFilte...
[ "private", "void", "buildWhere", "(", "final", "StringBuilder", "whereBuilder", ",", "final", "List", "<", "Object", ">", "paramList", ",", "final", "Filter", "filter", ")", "throws", "RepositoryException", "{", "if", "(", "null", "==", "filter", ")", "{", "...
Builds 'WHERE' part with the specified where build, param list and filter. @param whereBuilder the specified where builder @param paramList the specified param list @param filter the specified filter @throws RepositoryException RepositoryException
[ "Builds", "WHERE", "part", "with", "the", "specified", "where", "build", "param", "list", "and", "filter", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java#L601-L611
47,877
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java
JdbcRepository.buildOrderBy
private void buildOrderBy(final StringBuilder orderByBuilder, final Map<String, SortDirection> sorts) { boolean isFirst = true; String querySortDirection; for (final Map.Entry<String, SortDirection> sort : sorts.entrySet()) { if (isFirst) { orderByBuilder.append(" OR...
java
private void buildOrderBy(final StringBuilder orderByBuilder, final Map<String, SortDirection> sorts) { boolean isFirst = true; String querySortDirection; for (final Map.Entry<String, SortDirection> sort : sorts.entrySet()) { if (isFirst) { orderByBuilder.append(" OR...
[ "private", "void", "buildOrderBy", "(", "final", "StringBuilder", "orderByBuilder", ",", "final", "Map", "<", "String", ",", "SortDirection", ">", "sorts", ")", "{", "boolean", "isFirst", "=", "true", ";", "String", "querySortDirection", ";", "for", "(", "fina...
Builds 'ORDER BY' part with the specified order by build and sorts. @param orderByBuilder the specified order by builder @param sorts the specified sorts
[ "Builds", "ORDER", "BY", "part", "with", "the", "specified", "order", "by", "build", "and", "sorts", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java#L619-L638
47,878
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java
JdbcRepository.getConnection
private Connection getConnection() { final JdbcTransaction jdbcTransaction = TX.get(); if (null != jdbcTransaction && jdbcTransaction.isActive()) { return jdbcTransaction.getConnection(); } Connection ret = CONN.get(); try { if (null != ret && !ret.isClos...
java
private Connection getConnection() { final JdbcTransaction jdbcTransaction = TX.get(); if (null != jdbcTransaction && jdbcTransaction.isActive()) { return jdbcTransaction.getConnection(); } Connection ret = CONN.get(); try { if (null != ret && !ret.isClos...
[ "private", "Connection", "getConnection", "(", ")", "{", "final", "JdbcTransaction", "jdbcTransaction", "=", "TX", ".", "get", "(", ")", ";", "if", "(", "null", "!=", "jdbcTransaction", "&&", "jdbcTransaction", ".", "isActive", "(", ")", ")", "{", "return", ...
getConnection. default using current JdbcTransaction's connection, if null get a new one. @return {@link Connection}
[ "getConnection", ".", "default", "using", "current", "JdbcTransaction", "s", "connection", "if", "null", "get", "a", "new", "one", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java#L787-L807
47,879
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java
JdbcRepository.processPropertyFilter
private void processPropertyFilter(final StringBuilder whereBuilder, final List<Object> paramList, final PropertyFilter propertyFilter) throws RepositoryException { String filterOperator; switch (propertyFilter.getOperator()) { case EQUAL: ...
java
private void processPropertyFilter(final StringBuilder whereBuilder, final List<Object> paramList, final PropertyFilter propertyFilter) throws RepositoryException { String filterOperator; switch (propertyFilter.getOperator()) { case EQUAL: ...
[ "private", "void", "processPropertyFilter", "(", "final", "StringBuilder", "whereBuilder", ",", "final", "List", "<", "Object", ">", "paramList", ",", "final", "PropertyFilter", "propertyFilter", ")", "throws", "RepositoryException", "{", "String", "filterOperator", "...
Processes property filter. @param whereBuilder the specified where builder @param paramList the specified parameter list @param propertyFilter the specified property filter @throws RepositoryException repository exception
[ "Processes", "property", "filter", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java#L817-L893
47,880
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java
JdbcRepository.processCompositeFilter
private void processCompositeFilter(final StringBuilder whereBuilder, final List<Object> paramList, final CompositeFilter compositeFilter) throws RepositoryException { final List<Filter> subFilters = compositeFilter.getSubFilters(); if (2 > subFilters.size()) { ...
java
private void processCompositeFilter(final StringBuilder whereBuilder, final List<Object> paramList, final CompositeFilter compositeFilter) throws RepositoryException { final List<Filter> subFilters = compositeFilter.getSubFilters(); if (2 > subFilters.size()) { ...
[ "private", "void", "processCompositeFilter", "(", "final", "StringBuilder", "whereBuilder", ",", "final", "List", "<", "Object", ">", "paramList", ",", "final", "CompositeFilter", "compositeFilter", ")", "throws", "RepositoryException", "{", "final", "List", "<", "F...
Processes composite filter. @param whereBuilder the specified where builder @param paramList the specified parameter list @param compositeFilter the specified composite filter @throws RepositoryException repository exception
[ "Processes", "composite", "filter", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java#L903-L939
47,881
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java
JdbcRepository.toOracleClobEmpty
private static void toOracleClobEmpty(final JSONObject jsonObject) { final Iterator<String> keys = jsonObject.keys(); try { while (keys.hasNext()) { final String name = keys.next(); final Object val = jsonObject.get(name); if (val instanceof St...
java
private static void toOracleClobEmpty(final JSONObject jsonObject) { final Iterator<String> keys = jsonObject.keys(); try { while (keys.hasNext()) { final String name = keys.next(); final Object val = jsonObject.get(name); if (val instanceof St...
[ "private", "static", "void", "toOracleClobEmpty", "(", "final", "JSONObject", "jsonObject", ")", "{", "final", "Iterator", "<", "String", ">", "keys", "=", "jsonObject", ".", "keys", "(", ")", ";", "try", "{", "while", "(", "keys", ".", "hasNext", "(", "...
Process Oracle CLOB empty string. @param jsonObject the specified JSON object
[ "Process", "Oracle", "CLOB", "empty", "string", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/JdbcRepository.java#L951-L967
47,882
b3log/latke
latke-core/src/main/java/org/b3log/latke/event/EventManager.java
EventManager.fireEventAsynchronously
public <T> Future<T> fireEventAsynchronously(final Event<?> event) { final FutureTask<T> futureTask = new FutureTask<T>(() -> { synchronizedEventQueue.fireEvent(event); return null; // XXX: Our future???? }); Latkes.EXECUTOR_SERVICE.execute(futureTask); return ...
java
public <T> Future<T> fireEventAsynchronously(final Event<?> event) { final FutureTask<T> futureTask = new FutureTask<T>(() -> { synchronizedEventQueue.fireEvent(event); return null; // XXX: Our future???? }); Latkes.EXECUTOR_SERVICE.execute(futureTask); return ...
[ "public", "<", "T", ">", "Future", "<", "T", ">", "fireEventAsynchronously", "(", "final", "Event", "<", "?", ">", "event", ")", "{", "final", "FutureTask", "<", "T", ">", "futureTask", "=", "new", "FutureTask", "<", "T", ">", "(", "(", ")", "->", ...
Fire the specified event asynchronously. @param <T> the result type @param event the specified event @return future result
[ "Fire", "the", "specified", "event", "asynchronously", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/event/EventManager.java#L54-L64
47,883
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/Repositories.java
Repositories.setRepositoriesWritable
public static void setRepositoriesWritable(final boolean writable) { for (final Map.Entry<String, Repository> entry : REPOS_HOLDER.entrySet()) { final String repositoryName = entry.getKey(); final Repository repository = entry.getValue(); repository.setWritable(writable); ...
java
public static void setRepositoriesWritable(final boolean writable) { for (final Map.Entry<String, Repository> entry : REPOS_HOLDER.entrySet()) { final String repositoryName = entry.getKey(); final Repository repository = entry.getValue(); repository.setWritable(writable); ...
[ "public", "static", "void", "setRepositoriesWritable", "(", "final", "boolean", "writable", ")", "{", "for", "(", "final", "Map", ".", "Entry", "<", "String", ",", "Repository", ">", "entry", ":", "REPOS_HOLDER", ".", "entrySet", "(", ")", ")", "{", "final...
Sets all repositories whether is writable with the specified flag. @param writable the specified flat, {@code true} for writable, {@code false} otherwise
[ "Sets", "all", "repositories", "whether", "is", "writable", "with", "the", "specified", "flag", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/Repositories.java#L85-L96
47,884
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/Repositories.java
Repositories.getRepositoryNames
public static JSONArray getRepositoryNames() { final JSONArray ret = new JSONArray(); if (null == repositoriesDescription) { LOGGER.log(Level.INFO, "Not found repository description[repository.json] file under classpath"); return ret; } final JSONArray reposito...
java
public static JSONArray getRepositoryNames() { final JSONArray ret = new JSONArray(); if (null == repositoriesDescription) { LOGGER.log(Level.INFO, "Not found repository description[repository.json] file under classpath"); return ret; } final JSONArray reposito...
[ "public", "static", "JSONArray", "getRepositoryNames", "(", ")", "{", "final", "JSONArray", "ret", "=", "new", "JSONArray", "(", ")", ";", "if", "(", "null", "==", "repositoriesDescription", ")", "{", "LOGGER", ".", "log", "(", "Level", ".", "INFO", ",", ...
Gets repository names. @return repository names, for example, <pre> [ "repository1", "repository2", .... ] </pre>
[ "Gets", "repository", "names", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/Repositories.java#L108-L126
47,885
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/Repositories.java
Repositories.getRepositoryDef
public static JSONObject getRepositoryDef(final String repositoryName) { if (StringUtils.isBlank(repositoryName)) { return null; } if (null == repositoriesDescription) { return null; } final JSONArray repositories = repositoriesDescription.optJSONArray("...
java
public static JSONObject getRepositoryDef(final String repositoryName) { if (StringUtils.isBlank(repositoryName)) { return null; } if (null == repositoriesDescription) { return null; } final JSONArray repositories = repositoriesDescription.optJSONArray("...
[ "public", "static", "JSONObject", "getRepositoryDef", "(", "final", "String", "repositoryName", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "repositoryName", ")", ")", "{", "return", "null", ";", "}", "if", "(", "null", "==", "repositoriesDescript...
Gets the repository definition of an repository specified by the given repository name. @param repositoryName the given repository name (maybe with table name prefix) @return repository definition, returns {@code null} if not found
[ "Gets", "the", "repository", "definition", "of", "an", "repository", "specified", "by", "the", "given", "repository", "name", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/Repositories.java#L230-L248
47,886
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/Repositories.java
Repositories.loadRepositoryDescription
private static void loadRepositoryDescription() { LOGGER.log(Level.INFO, "Loading repository description...."); final InputStream inputStream = AbstractRepository.class.getResourceAsStream("/repository.json"); if (null == inputStream) { LOGGER.log(Level.INFO, "Not found repository ...
java
private static void loadRepositoryDescription() { LOGGER.log(Level.INFO, "Loading repository description...."); final InputStream inputStream = AbstractRepository.class.getResourceAsStream("/repository.json"); if (null == inputStream) { LOGGER.log(Level.INFO, "Not found repository ...
[ "private", "static", "void", "loadRepositoryDescription", "(", ")", "{", "LOGGER", ".", "log", "(", "Level", ".", "INFO", ",", "\"Loading repository description....\"", ")", ";", "final", "InputStream", "inputStream", "=", "AbstractRepository", ".", "class", ".", ...
Loads repository description.
[ "Loads", "repository", "description", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/Repositories.java#L298-L339
47,887
b3log/latke
latke-core/src/main/java/org/b3log/latke/servlet/AbstractServletListener.java
AbstractServletListener.contextInitialized
@Override public void contextInitialized(final ServletContextEvent servletContextEvent) { servletContext = servletContextEvent.getServletContext(); Latkes.init(); LOGGER.info("Initializing the context...."); Latkes.setLocale(Locale.SIMPLIFIED_CHINESE); LOGGER.log(Level.INFO...
java
@Override public void contextInitialized(final ServletContextEvent servletContextEvent) { servletContext = servletContextEvent.getServletContext(); Latkes.init(); LOGGER.info("Initializing the context...."); Latkes.setLocale(Locale.SIMPLIFIED_CHINESE); LOGGER.log(Level.INFO...
[ "@", "Override", "public", "void", "contextInitialized", "(", "final", "ServletContextEvent", "servletContextEvent", ")", "{", "servletContext", "=", "servletContextEvent", ".", "getServletContext", "(", ")", ";", "Latkes", ".", "init", "(", ")", ";", "LOGGER", "....
Initializes context, locale and runtime environment. @param servletContextEvent servlet context event
[ "Initializes", "context", "locale", "and", "runtime", "environment", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/servlet/AbstractServletListener.java#L72-L93
47,888
b3log/latke
latke-core/src/main/java/org/b3log/latke/ioc/Bean.java
Bean.resolveDependencies
private void resolveDependencies(final Object reference) { final Class<?> superclass = reference.getClass().getSuperclass().getSuperclass(); // Proxy -> Orig -> Super resolveSuperclassFieldDependencies(reference, superclass); resolveCurrentclassFieldDependencies(reference); }
java
private void resolveDependencies(final Object reference) { final Class<?> superclass = reference.getClass().getSuperclass().getSuperclass(); // Proxy -> Orig -> Super resolveSuperclassFieldDependencies(reference, superclass); resolveCurrentclassFieldDependencies(reference); }
[ "private", "void", "resolveDependencies", "(", "final", "Object", "reference", ")", "{", "final", "Class", "<", "?", ">", "superclass", "=", "reference", ".", "getClass", "(", ")", ".", "getSuperclass", "(", ")", ".", "getSuperclass", "(", ")", ";", "// Pr...
Resolves dependencies for the specified reference. @param reference the specified reference
[ "Resolves", "dependencies", "for", "the", "specified", "reference", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/ioc/Bean.java#L136-L141
47,889
b3log/latke
latke-core/src/main/java/org/b3log/latke/ioc/Bean.java
Bean.instantiateReference
private T instantiateReference() throws Exception { final T ret = proxyClass.newInstance(); ((ProxyObject) ret).setHandler(javassistMethodHandler); LOGGER.log(Level.TRACE, "Uses Javassist method handler for bean [class={0}]", beanClass.getName()); return ret; }
java
private T instantiateReference() throws Exception { final T ret = proxyClass.newInstance(); ((ProxyObject) ret).setHandler(javassistMethodHandler); LOGGER.log(Level.TRACE, "Uses Javassist method handler for bean [class={0}]", beanClass.getName()); return ret; }
[ "private", "T", "instantiateReference", "(", ")", "throws", "Exception", "{", "final", "T", "ret", "=", "proxyClass", ".", "newInstance", "(", ")", ";", "(", "(", "ProxyObject", ")", "ret", ")", ".", "setHandler", "(", "javassistMethodHandler", ")", ";", "...
Constructs the bean object with dependencies resolved. @return bean object @throws Exception exception
[ "Constructs", "the", "bean", "object", "with", "dependencies", "resolved", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/ioc/Bean.java#L149-L156
47,890
b3log/latke
latke-core/src/main/java/org/b3log/latke/ioc/Bean.java
Bean.resolveCurrentclassFieldDependencies
private void resolveCurrentclassFieldDependencies(final Object reference) { for (final FieldInjectionPoint injectionPoint : fieldInjectionPoints) { final Object injection = beanManager.getInjectableReference(injectionPoint); final Field field = injectionPoint.getAnnotated().getJavaMember...
java
private void resolveCurrentclassFieldDependencies(final Object reference) { for (final FieldInjectionPoint injectionPoint : fieldInjectionPoints) { final Object injection = beanManager.getInjectableReference(injectionPoint); final Field field = injectionPoint.getAnnotated().getJavaMember...
[ "private", "void", "resolveCurrentclassFieldDependencies", "(", "final", "Object", "reference", ")", "{", "for", "(", "final", "FieldInjectionPoint", "injectionPoint", ":", "fieldInjectionPoints", ")", "{", "final", "Object", "injection", "=", "beanManager", ".", "get...
Resolves current class field dependencies for the specified reference. @param reference the specified reference
[ "Resolves", "current", "class", "field", "dependencies", "for", "the", "specified", "reference", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/ioc/Bean.java#L163-L186
47,891
b3log/latke
latke-core/src/main/java/org/b3log/latke/ioc/Bean.java
Bean.resolveSuperclassFieldDependencies
private void resolveSuperclassFieldDependencies(final Object reference, final Class<?> clazz) { if (clazz.equals(Object.class)) { return; } final Class<?> superclass = clazz.getSuperclass(); resolveSuperclassFieldDependencies(reference, superclass); if (Modifier.is...
java
private void resolveSuperclassFieldDependencies(final Object reference, final Class<?> clazz) { if (clazz.equals(Object.class)) { return; } final Class<?> superclass = clazz.getSuperclass(); resolveSuperclassFieldDependencies(reference, superclass); if (Modifier.is...
[ "private", "void", "resolveSuperclassFieldDependencies", "(", "final", "Object", "reference", ",", "final", "Class", "<", "?", ">", "clazz", ")", "{", "if", "(", "clazz", ".", "equals", "(", "Object", ".", "class", ")", ")", "{", "return", ";", "}", "fin...
Resolves super class field dependencies for the specified reference. @param reference the specified reference @param clazz the super class of the specified reference
[ "Resolves", "super", "class", "field", "dependencies", "for", "the", "specified", "reference", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/ioc/Bean.java#L194-L229
47,892
b3log/latke
latke-core/src/main/java/org/b3log/latke/ioc/Bean.java
Bean.initFieldInjectionPoints
private void initFieldInjectionPoints() { final Set<AnnotatedField<? super T>> annotatedFields = annotatedType.getFields(); for (final AnnotatedField<? super T> annotatedField : annotatedFields) { final FieldInjectionPoint fieldInjectionPoint = new FieldInjectionPoint(this, annotatedField);...
java
private void initFieldInjectionPoints() { final Set<AnnotatedField<? super T>> annotatedFields = annotatedType.getFields(); for (final AnnotatedField<? super T> annotatedField : annotatedFields) { final FieldInjectionPoint fieldInjectionPoint = new FieldInjectionPoint(this, annotatedField);...
[ "private", "void", "initFieldInjectionPoints", "(", ")", "{", "final", "Set", "<", "AnnotatedField", "<", "?", "super", "T", ">", ">", "annotatedFields", "=", "annotatedType", ".", "getFields", "(", ")", ";", "for", "(", "final", "AnnotatedField", "<", "?", ...
Initializes field injection points.
[ "Initializes", "field", "injection", "points", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/ioc/Bean.java#L271-L279
47,893
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/URLs.java
URLs.encode
public static String encode(final String str) { try { return URLEncoder.encode(str, "UTF-8"); } catch (final Exception e) { LOGGER.log(Level.WARN, "Encodes str [" + str + "] failed", e); return str; } }
java
public static String encode(final String str) { try { return URLEncoder.encode(str, "UTF-8"); } catch (final Exception e) { LOGGER.log(Level.WARN, "Encodes str [" + str + "] failed", e); return str; } }
[ "public", "static", "String", "encode", "(", "final", "String", "str", ")", "{", "try", "{", "return", "URLEncoder", ".", "encode", "(", "str", ",", "\"UTF-8\"", ")", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "LOGGER", ".", "log", ...
Encodes the specified string. @param str the specified string @return URL encoded string
[ "Encodes", "the", "specified", "string", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/URLs.java#L44-L52
47,894
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/URLs.java
URLs.decode
public static String decode(final String str) { try { return URLDecoder.decode(str, "UTF-8"); } catch (final Exception e) { LOGGER.log(Level.WARN, "Decodes str [" + str + "] failed", e); return str; } }
java
public static String decode(final String str) { try { return URLDecoder.decode(str, "UTF-8"); } catch (final Exception e) { LOGGER.log(Level.WARN, "Decodes str [" + str + "] failed", e); return str; } }
[ "public", "static", "String", "decode", "(", "final", "String", "str", ")", "{", "try", "{", "return", "URLDecoder", ".", "decode", "(", "str", ",", "\"UTF-8\"", ")", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "LOGGER", ".", "log", ...
Decodes the specified string. @param str the specified string @return URL decoded string
[ "Decodes", "the", "specified", "string", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/URLs.java#L60-L68
47,895
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/util/JdbcRepositories.java
JdbcRepositories.getKeys
public static List<FieldDefinition> getKeys(final String repositoryName) { final List<RepositoryDefinition> repositoryDefs = getRepositoryDefinitions(); for (final RepositoryDefinition repositoryDefinition : repositoryDefs) { if (StringUtils.equals(repositoryName, repositoryDefinition.getNam...
java
public static List<FieldDefinition> getKeys(final String repositoryName) { final List<RepositoryDefinition> repositoryDefs = getRepositoryDefinitions(); for (final RepositoryDefinition repositoryDefinition : repositoryDefs) { if (StringUtils.equals(repositoryName, repositoryDefinition.getNam...
[ "public", "static", "List", "<", "FieldDefinition", ">", "getKeys", "(", "final", "String", "repositoryName", ")", "{", "final", "List", "<", "RepositoryDefinition", ">", "repositoryDefs", "=", "getRepositoryDefinitions", "(", ")", ";", "for", "(", "final", "Rep...
Gets keys of the repository specified by the given repository name. @param repositoryName the given repository name @return keys
[ "Gets", "keys", "of", "the", "repository", "specified", "by", "the", "given", "repository", "name", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/util/JdbcRepositories.java#L134-L143
47,896
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/util/JdbcRepositories.java
JdbcRepositories.getRepositoryDefinitions
public static List<RepositoryDefinition> getRepositoryDefinitions() { if (null == repositoryDefinitions) { try { initRepositoryDefinitions(); } catch (final Exception e) { LOGGER.log(Level.ERROR, "Init repository definitions failed", e); } ...
java
public static List<RepositoryDefinition> getRepositoryDefinitions() { if (null == repositoryDefinitions) { try { initRepositoryDefinitions(); } catch (final Exception e) { LOGGER.log(Level.ERROR, "Init repository definitions failed", e); } ...
[ "public", "static", "List", "<", "RepositoryDefinition", ">", "getRepositoryDefinitions", "(", ")", "{", "if", "(", "null", "==", "repositoryDefinitions", ")", "{", "try", "{", "initRepositoryDefinitions", "(", ")", ";", "}", "catch", "(", "final", "Exception", ...
Gets the repository definitions,lazy load. @return repository definitions
[ "Gets", "the", "repository", "definitions", "lazy", "load", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/util/JdbcRepositories.java#L150-L160
47,897
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/util/JdbcRepositories.java
JdbcRepositories.initRepositoryDefinitions
private static void initRepositoryDefinitions() throws JSONException { final JSONObject jsonObject = Repositories.getRepositoriesDescription(); if (null == jsonObject) { LOGGER.warn("Loads repository description [repository.json] failed"); return; } repositoryDe...
java
private static void initRepositoryDefinitions() throws JSONException { final JSONObject jsonObject = Repositories.getRepositoriesDescription(); if (null == jsonObject) { LOGGER.warn("Loads repository description [repository.json] failed"); return; } repositoryDe...
[ "private", "static", "void", "initRepositoryDefinitions", "(", ")", "throws", "JSONException", "{", "final", "JSONObject", "jsonObject", "=", "Repositories", ".", "getRepositoriesDescription", "(", ")", ";", "if", "(", "null", "==", "jsonObject", ")", "{", "LOGGER...
Initializes the repository definitions. @throws JSONException JSONException
[ "Initializes", "the", "repository", "definitions", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/util/JdbcRepositories.java#L167-L198
47,898
b3log/latke
latke-core/src/main/java/org/b3log/latke/repository/jdbc/util/JdbcRepositories.java
JdbcRepositories.initAllTables
public static List<CreateTableResult> initAllTables() { final List<CreateTableResult> ret = new ArrayList<>(); final List<RepositoryDefinition> repositoryDefs = getRepositoryDefinitions(); boolean isSuccess = false; for (final RepositoryDefinition repositoryDef : repositoryDefs) { ...
java
public static List<CreateTableResult> initAllTables() { final List<CreateTableResult> ret = new ArrayList<>(); final List<RepositoryDefinition> repositoryDefs = getRepositoryDefinitions(); boolean isSuccess = false; for (final RepositoryDefinition repositoryDef : repositoryDefs) { ...
[ "public", "static", "List", "<", "CreateTableResult", ">", "initAllTables", "(", ")", "{", "final", "List", "<", "CreateTableResult", ">", "ret", "=", "new", "ArrayList", "<>", "(", ")", ";", "final", "List", "<", "RepositoryDefinition", ">", "repositoryDefs",...
Initializes all tables from repository.json. @return List<CreateTableResult>
[ "Initializes", "all", "tables", "from", "repository", ".", "json", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/repository/jdbc/util/JdbcRepositories.java#L293-L308
47,899
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/UriTemplates.java
UriTemplates.resolve
public static Map<String, String> resolve(final String uri, final String uriTemplate) { final String[] parts = URLs.decode(uri).split("/"); final String[] templateParts = uriTemplate.split("/"); if (parts.length != templateParts.length) { return null; } final Map<Str...
java
public static Map<String, String> resolve(final String uri, final String uriTemplate) { final String[] parts = URLs.decode(uri).split("/"); final String[] templateParts = uriTemplate.split("/"); if (parts.length != templateParts.length) { return null; } final Map<Str...
[ "public", "static", "Map", "<", "String", ",", "String", ">", "resolve", "(", "final", "String", "uri", ",", "final", "String", "uriTemplate", ")", "{", "final", "String", "[", "]", "parts", "=", "URLs", ".", "decode", "(", "uri", ")", ".", "split", ...
Resolves the specified URI with the specified URI template. @param uri the specified URI @param uriTemplate the specified URI template @return resolved mappings of name and argument, returns {@code null} if failed
[ "Resolves", "the", "specified", "URI", "with", "the", "specified", "URI", "template", "." ]
f7e08a47eeecea5f7c94006382c24f353585de33
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/UriTemplates.java#L39-L66