private static <T extends Exception> T trimStackTrace(T ex) { List<StackTraceElement> elements = new ArrayList<>(); Collections.addAll(elements, ex.getStackTrace()); elements.remove(0); ex.setStackTrace(ReflectUtils.toArray(StackTraceElement.class, elements)); return ex; }
/** * @param offset the offset into the stack trace. * @return the name of the current method. */ public static String getMethodName(int offset) { return getElement(offset+1).getMethodName(); }
protected void injectVersion(T entity, WriteResponse response) { String version = response.getDocumentRevision(); CouchEntityMeta<T> meta = new AnnotationCouchMetaBuilder().buildEntityMeta(entityType); String property = meta.getRevisionName(); Field field = ReflectUtils.getField(entity.getClass(), property); ReflectUtils.setPropertyValue(entity, field, version); }
private static ComparisonResults.Builder compare(ComparisonResults.Builder builder, Field field, Object objectA, Object objectB, final String beanName) { Object valueA = (field == null) ? objectA : ReflectUtils.getFieldValue(objectA, field); Object valueB = (field == null) ? objectB : ReflectUtils.getFieldValue(objectB, field); List<Field> fields = ReflectUtils.getFields(valueA.getClass()); for (Field nextField : fields) { boolean isStatic = Modifier.isStatic(nextField.getModifiers());
@JsonCreator private NotificationPushV1(@JsonProperty("message") String message, @JsonProperty("callbackUrl") String callbackUrl, @JsonProperty("remoteHost") String remoteHost, @JsonProperty("remoteAddress") String remoteAddress, @JsonProperty("traits") Map<String, String> traits) { this.message = (message == null) ? "No message" : message.trim(); this.remoteHost = remoteHost; this.remoteAddress = remoteAddress; this.callbackUrl = callbackUrl; // Get a list of all the keys so that we can loop on the map // and remove anything without an actual value (purge nulls). if (traits != null) { this.traits.putAll(traits); } String[] keys = ReflectUtils.toArray(String.class, this.traits.keySet()); for (String key : keys) { if (StringUtils.isBlank(this.traits.get(key))) { this.traits.remove(key); } } }
public static String getClassName(int offset) { return getElement(offset+1).getClassName(); }
public void removeExpiredSessions() { synchronized (LOCK) { Session[] sessions = ReflectUtils.toArray(Session.class, map.values()); for (Session session : sessions) { if (session.isExpired()) { map.remove(session.getSessionId()); } } } }
private SesEmailPush(@JsonProperty("toAddress") String toAddress, @JsonProperty("fromAddress") String fromAddress, @JsonProperty("emailSubject") String emailSubject, @JsonProperty("htmlContent") String htmlContent, @JsonProperty("callbackUrl") String callbackUrl, @JsonProperty("remoteHost") String remoteHost, @JsonProperty("remoteAddress") String remoteAddress, @JsonProperty("traits") Map<String, String> traits) { this.toAddress = toAddress; this.fromAddress = fromAddress; this.emailSubject = emailSubject; String content = StringUtils.getTagContents(htmlContent, "body", 0); this.htmlContent = StringUtils.isNotBlank(content) ? content : htmlContent; this.callbackUrl = callbackUrl; this.remoteHost = remoteHost; this.remoteAddress = remoteAddress; // Get a list of all the keys so that we can loop on the map // and remove anything without an actual value (purge nulls). if (traits != null) { this.traits.putAll(traits); } String[] keys = ReflectUtils.toArray(String.class, this.traits.keySet()); for (String key : keys) { if (StringUtils.isBlank(this.traits.get(key))) { this.traits.remove(key); } } }
private SmtpEmailPush(@JsonProperty("toAddress") String toAddress, @JsonProperty("fromAddress") String fromAddress, @JsonProperty("emailSubject") String emailSubject, @JsonProperty("htmlContent") String htmlContent, @JsonProperty("callbackUrl") String callbackUrl, @JsonProperty("remoteHost") String remoteHost, @JsonProperty("remoteAddress") String remoteAddress, @JsonProperty("traits") Map<String, String> traits) { this.toAddress = toAddress; this.fromAddress = fromAddress; this.emailSubject = emailSubject; String content = StringUtils.getTagContents(htmlContent, "body", 0); this.htmlContent = StringUtils.isNotBlank(content) ? content : htmlContent; this.callbackUrl = callbackUrl; this.remoteHost = remoteHost; this.remoteAddress = remoteAddress; // Get a list of all the keys so that we can loop on the map // and remove anything without an actual value (purge nulls). if (traits != null) { this.traits.putAll(traits); } String[] keys = ReflectUtils.toArray(String.class, this.traits.keySet()); for (String key : keys) { if (StringUtils.isBlank(this.traits.get(key))) { this.traits.remove(key); } } }
private SesEmailPush(@JsonProperty("toAddress") String toAddress, @JsonProperty("fromAddress") String fromAddress, @JsonProperty("emailSubject") String emailSubject, @JsonProperty("htmlContent") String htmlContent, @JsonProperty("callbackUrl") String callbackUrl, @JsonProperty("remoteHost") String remoteHost, @JsonProperty("remoteAddress") String remoteAddress, @JsonProperty("traits") Map<String, String> traits) { this.toAddress = toAddress; this.fromAddress = fromAddress; this.emailSubject = emailSubject; String content = StringUtils.getTagContents(htmlContent, "body", 0); this.htmlContent = StringUtils.isNotBlank(content) ? content : htmlContent; this.callbackUrl = callbackUrl; this.remoteHost = remoteHost; this.remoteAddress = remoteAddress; // Get a list of all the keys so that we can loop on the map // and remove anything without an actual value (purge nulls). if (traits != null) { this.traits.putAll(traits); } String[] keys = ReflectUtils.toArray(String.class, this.traits.keySet()); for (String key : keys) { if (StringUtils.isBlank(this.traits.get(key))) { this.traits.remove(key); } } }
private SmtpEmailPush(@JsonProperty("toAddress") String toAddress, @JsonProperty("fromAddress") String fromAddress, @JsonProperty("emailSubject") String emailSubject, @JsonProperty("htmlContent") String htmlContent, @JsonProperty("callbackUrl") String callbackUrl, @JsonProperty("remoteHost") String remoteHost, @JsonProperty("remoteAddress") String remoteAddress, @JsonProperty("traits") Map<String, String> traits) { this.toAddress = toAddress; this.fromAddress = fromAddress; this.emailSubject = emailSubject; String content = StringUtils.getTagContents(htmlContent, "body", 0); this.htmlContent = StringUtils.isNotBlank(content) ? content : htmlContent; this.callbackUrl = callbackUrl; this.remoteHost = remoteHost; this.remoteAddress = remoteAddress; // Get a list of all the keys so that we can loop on the map // and remove anything without an actual value (purge nulls). if (traits != null) { this.traits.putAll(traits); } String[] keys = ReflectUtils.toArray(String.class, this.traits.keySet()); for (String key : keys) { if (StringUtils.isBlank(this.traits.get(key))) { this.traits.remove(key); } } }
setLocations(ReflectUtils.toArray(Resource.class, resources));
JOptionPane.QUESTION_MESSAGE, null, ReflectUtils.toArray(String.class, operationsMap.keySet()), name);
String[] commandArray = ReflectUtils.toArray(String.class, commands);
String[] commandArray = ReflectUtils.toArray(String.class, commands);
String[] commandArray = ReflectUtils.toArray(String.class, commands);